gpt4 book ai didi

javascript - 内联网格 kendoComboBox 在 javascript 中获取值

转载 作者:行者123 更新时间:2023-12-01 15:11:14 25 4
gpt4 key购买 nike

这是我的功能 userNameEditor

function userNameEditor(container, options) {
$('<input required data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoComboBox({
dataTextField: "UserName",
dataValueField: "UserId",
filter: "contains",
minLength: 3,
//_readMethod: '../Warehouse/SearchUser',
dataSource: new kendo.data.DataSource({
transport: {
contentType: "application/json; charset=utf-8",
serverFiltering: true,
read: {
url: "../Warehouse/SearchUser",
//data: { //?????????//
// q: function () {
// return $("#autoComplete").data("kendoAutoComplete").value();
// },
// maxRows: 10,
// username: "demo"
//}
},
},
}),
})
}
我要抓 kendoComboBox 值转到 Controller 并返回用户名包含值,请给我取值的方法!!!!
这是我的网格列区域
grid._columns.push(grid.GridColumn('Id', null, '200px', null, null, null, null, null, null, null, true));
grid._columns.push(grid.GridColumn('User', 'User', '200px', null, "#=User.UserName#", null, null, null, null, null, null, null, null, null, userNameEditor));
grid._columns.push(grid.GridColumn(null, ' ', '200px', { style: 'text-align:right' }, null, null, null, null, null, null, null, null, null, ['edit', 'destroy']));

最佳答案

嗨,伙计们,这是我的回答。我希望这个答案对你有所帮助。而 Teleric 的人 Alex 给我这个链接也许可以帮助 https://dojo.telerik.com/@bubblemaster/IYekeYoc

function userNameEditor(container, options) {
debugger;
var gridDataSource = new kendo.data.DataSource({
transport: {
read: {
url: '../Warehouse/SearchUser',
dataType: "json"
},
success: function(e) {
debugger;
},
error: function (e) {
debugger;
}
}
});
var cmb=$('<input name="' + options.field + '"/>')
.appendTo(container)
.kendoComboBox({
autoBind: false,
dataTextField: "UserFullName",
dataValueField: "Id",
filter: "contains",
minLength: 3,
dataSource: gridDataSource,
filtering: function (e) {

var filter = e.filter;
gridDataSource.read({ userSearchText: filter.value });
//dataSource.filter({ userSearchText: filter.value });
},
dataBound: function (e) {
debugger;
var equipmentData = e.sender.dataSource.data();


$.each(equipmentData, function (index, selectedEquipmentData) {
var dataItem = e.sender.dataSource.at(index);

});
},
select: function(e) {
debugger;
this.refresh();
},
complete: function(e) {
debugger;
},
error: function(e) {
debugger;
}
}).data('kendoComboBox');
cmb.refresh();
debugger;
//.kendoComboBox({
// autoBind: false,
// dataTextField: "NameSurname",
// dataValueField: "Id",
// filter: "contains",
// minLength: 3,
// dataSource: dataSource,
// filtering: function (e) {
// debugger;
// var filter = e.filter;
// //dataSource.read({ userSearchText: filter.value });
// dataSource.filter({ userSearchText: filter.value })
// }
//});
};

关于javascript - 内联网格 kendoComboBox 在 javascript 中获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63488025/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com