ali navidi moghadam
ali navidi moghadam

Reputation: 1

telerik grid combo column js

i have a telerik grid in js, with a combo box column

My problem is that when I set editable to true, the combo disappears after selecting a complete item. But when the grid is editable:false, there is no problem with the combo box

this is my javascript code:

`var ddlDataSource = [{
    value: 1,
    displayValue: "one"
},
{
    value: 2,
    displayValue: "two"
},
{
    value: 3,
    displayValue: "three"
}
];

$("#grid").kendoGrid({
    columns: [
        {
            field: "value",
            template: columnTemplateFunction
        },
        {
            field: "aaa"
        },
        {
            field: "aaa2"
        },
        {
            field: "aaa3"
        }
    ],
    dataSource: {
        transport: {
            read: {
                url: "Home/Customers_Read3",
                dataType: "json",
                cache: false
            },
            update: {
                url: "Home/Customers_Read3",
                dataType: "json"
            },
            destroy: {
                url: "Home/Customers_Read3",
                dataType: "json"
            }
        },
        pageSize: 10
    },
    dataBound: function (e) {
        var grid = e.sender;
        var items = e.sender.items();

        items.each(function (e) {
            var dataItem = grid.dataItem(this);
            var ddt = $(this).find('.dropDownTemplate');

            $(ddt).kendoDropDownList({
                value: dataItem.value,
                //dataSource: ddlDataSource,
                dataSource: {
                    transport: {
                        read: {
                            url: "Home/ReadCombp",
                            dataType: "json",
                            cache: false
                        }
                    }
                },
                dataTextField: "displayValue",
                dataValueField: "value",
                change: onDDLChange
            });
        });
    }
});

function columnTemplateFunction(dataItem) {
    var input = ''
    return input
};

function onDDLChange(e) {
    var element = e.sender.element;
    var row = element.closest("tr");
    var grid = $("#grid").data("kendoGrid");
    var dataItem = grid.dataItem(row);
    //debugger;

    dataItem.set("value", e.sender.value());
};`

I want my grid to be editable and I also want to be able to use the combo box in one of its columns in the form of the above example.

Upvotes: 0

Views: 10

Answers (0)

Related Questions