How to create kendoNumericTextBox in kendo grid cell? -
is there way create widgets in kendo grid cell template? here sample code.
columns: [{ field: "name", title: "contact name", width: 100 }, { field: "cost", title: "cost", template: "<input value='#: cost #'> </input>",// input must numerical down. }]
i want create numerical down cost column.
here demo
use "editor" property in field definition. have specify function append widget row/bound cell.
here's example put drop downlist in each of rows of grid:
$('#grdusers').kendogrid({ scrollable: true, sortable: true, filterable: true, pageable: { refresh: true, pagesizes: true }, columns: [ { field: "id", title: "id", hidden: true }, { field: "username", title: "username" }, { field: "firstname", title: "first name" }, { field: "lastname", title: "last name" }, { field: "email", title: "email" }, { field: "team", title: "team", editor: teamedit, template: "#=team ? team.name : 'select team'#" }, { command: { text: "save", click: saveemployee }, width: '85px' }, { command: { text: "delete", click: deleteemployee }, width: '85px' } ], editable: true, toolbar: [{ name: "create-user", text: "new employee" }] }); function teamedit(container, options) { $('<input required data-text-field="name" data-value-field="id" data-bind="value:' + options.field + '"/>') .appendto(container) .kendodropdownlist({ autobind: false, optionlabel: { name: "select team", id: "" }, datatextfield: "name", datavaluefield: "id", datasource: model.getallteams() }); }
Comments
Post a Comment