Inline Grid kendoComboBox get value in javascript
Asked Answered
F

1

7

This is my function 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"
            //}
          },
        },
      }),
    })
}

I want to catch kendoComboBox value go controller and come back with user name contains value just give me way to take value PLEASE!!!!

This is my grid column area

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']));
Flay answered 19/8, 2020 at 13:25 Comment(0)
F
0

Hy guys this is my answer.I hope this answer help you.And teleric people Alex give me that link maybe can help 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 })
        //    }
        //});
};
Flay answered 28/8, 2020 at 6:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.