我是Asp.net核心2的新手.Asp.net核心2的新内容之一是页面.但我无法弄明白
我有以下场景:
public JsonResult ChangeFilterList(int option)
{
var data = new[] { new { Text = "Unknown option", Value = -1 } };
switch (option)
{
case 2: data = _departmentnameRepository.All.Select(x => new { Text = x.DeptName, Value = x.Id }).ToArray();
break;
case 3: data = Session["projectid"] == null
? _assetSequenceRepository.All.Select(x => new { Text = x.AssetShotName, Value = x.Id }).ToArray()
: _assetSequenceRepository.FindBy(p => p.ProjectId == (int)Session["projectid"]).Select(x => new { Text = x.AssetShotName, Value = x.Id }).ToArray();
break;
default: data = …Run Code Online (Sandbox Code Playgroud) 我有下面的网格和按钮。我想要实现的是在单击 btnAdd 时触发 Kendoui 弹出窗口。我知道如果您将按钮放在 kendo ui 网格工具栏中,就可以实现这一点。
请指教,谢谢
<script>
$('#btnAdd').click(function () {
});
</script>
<input type="button" id="btnAdd"/>
@(Html.Kendo().Grid<PWeb_App.ViewModels.ResultModel>()
.Name("Result")
.HtmlAttributes(new { @Style = "align:center; font-size:10px; width:985px" })
.Columns(columns =>
{
columns.Bound(p => p.GivenName).Width(90);
columns.Bound(p => p.FamilyName).Width(90);
})
.ToolBar(toolbar => toolbar.Save())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Sortable()
.Pageable(paging => paging
.Input(false)
.Numeric(true)
.PreviousNext(true)
.PageSizes(new int[] { 5, 10, 25, 50 })
.Refresh(false)
)
.Selectable()
.Scrollable()
.ColumnMenu(c => c.Columns(false))
.DataSource(dataSource => dataSource
.Ajax()//bind with Ajax instead server bind
.PageSize(10)
.ServerOperation(true)
.Model(model =>
{ …Run Code Online (Sandbox Code Playgroud) 输入数组类似于:
[0,0,1,2,4,7,9,6,4,4,2,1,0,0,0,0,0,3,5,5,10,3,2,1,4,5,7,7,12,11,8,4,2,
1,1,1,2,4,9,4,2,2,0,1,3,6,13,11,5,5,2,2,3,4,7,11,8...]
Run Code Online (Sandbox Code Playgroud)
正如我们所看到的,阵列中有丘陵和山谷,同一个山谷的重复(可能)最小值.我扩展了这个(解决具有不同元素的数组)的想法,以找到上面的解决方案:
/// <summary>
/// Returns index array where valley lies
/// </summary>
/// <param name="arraySmoothed"></param>
/// <returns></returns>
private static List<int> GetValleys(List<int> arraySmoothed) {
List<int> valleys = new List<int>();
List<int> tempValley = new List<int>();
bool contdValleyValues = false;
for (int i = 0; i < arraySmoothed.Count; i++) {
// A[i] is minima if A[i-1] >= A[i] <= A[i+1], <= instead of < is deliberate otherwise it won't work for consecutive repeating minima values for a valley …Run Code Online (Sandbox Code Playgroud) 我有一个JavaScript函数:
function nodeExists(text, ancestor, tree, generationCount) {
tree.findByText(text).each(function (index, element) {
var gen = generationCount;
var currNode = element;
while (gen !== 1) { // 1: node itself
currNode = tree.parent(currNode);
gen--;
}
if (tree.text(currNode) === ancestor)
return currNode; // Even if condition is met, control continues looping
})
return null;
//return ($.inArray(ancestor, gArr) !== -1) ? true : false;
}
Run Code Online (Sandbox Code Playgroud)
虽然调试功能没有退出循环,即使tree.text(currNode) === ancestor是真的.是Jquery .each导致它.请帮我.
c# ×2
razor ×2
arrays ×1
asp.net-core ×1
asp.net-mvc ×1
javascript ×1
jquery ×1
kendo-grid ×1
kendo-ui ×1
linq ×1