kendo-uikendo-combobox

Not able to get value from the Kendo Combobox


I am using below code in Kendo Grid editor but unable to access value of selected item value from Combobox.

Moreover, I have done same thing in Kendo drop down list but unable to kendo Combobox, so if anyone has solution please let me know.

Thanks in Advance !

{
                    field: "SalesBookId",
                    title: "Sales Book",
                    template: "#= (typeof SalesBookId != 'undefined') ? GetSalesBookName(SalesBookId):'' #",
                    editor: function (container, options) {

                        $('<input required data-text-field="SalesBookName" data-value-field="SalesBookId" data-bind="value:' + options.field + '"/>')
                            .appendTo(container)
                            .kendoComboBox({
                                autoBind: false,
                                dataSource: dsSalesBookDropDown,

                            });
                    }
                },

Solution

  • You have not shown the dsSalesBookDropDown, nor GetSalesBookName so it is hard to know what is wrong in your specific case.

    This dojo demonstrates that when the configurations, handlers and data all align properly there should not be a problem.

    The dojo is a based on the example "Grid with local data", your SalesBook concept is changed to Seller for the example.

    Code related to the custom editor include

    var sellers = [
      { SellerId: 1, Name: "Andrew" },
      { SellerId: 2, Name: "Basil" },
      { SellerId: 3, Name: "Chuck" },
      { SellerId: 4, Name: "Dennis" },
      { SellerId: 5, Name: "Edward" }
      ];
    
    var dsSellersDropDown = sellers;    
    
    function GetSellerName (id) {
      var seller = sellers.find(function(x) {return x.SellerId == id });
      return (seller) ? seller.Name : "** invalid id " + id + " **";
    }
    
    var products = [{
        ProductID : 1,
        ProductName : "Chai",
    SellerId: 1,
        SupplierID : 1,
        CategoryID : 1,
    . . .
    

    grid config

                            dataSource: {
                                data: products,
                                schema: {
                                    model: {
                                        fields: {
                                            ProductName: { type: "string" },
    SellerId: { type: "number" },
    

    and

                            columns: [
                                "ProductName",
    { field: "SellerId",
      title: "Seller Name",
      template: "#= (typeof SellerId != 'undefined') ? GetSellerName(SellerId):'' #",
      editor: function (container, options) {
    
        $('<input required data-text-field="Name" data-value-field="SellerId" data-bind="value:' 
    +
    options.field
    + '"/>')
        .appendTo(container)
        .kendoComboBox({
            autoBind: false,
            dataSource: dsSellersDropDown,
         });
      }
    },
                            { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },