jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid Editing using DropDown list json
Tagged: datagrid, dropdownlist editor, grid, gridview widget, jqxgrid
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 9 months ago.
-
Author
-
Do you have an example, editing a grid column using a dropdown list from json?
Hi David,
We do not have such sample. All examples that we have are available online: jqxGrid Demos. The dropdownlist editor is populated automatically using the column’s unique cell values. If you want to override this, you can use the column’s createeditor function which is called when the editor is initialized. For more information about that, please take a look at the help documentation about the ‘columns’ property here: jquery-grid-api.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comSo can the dataSource be a JSON, id, value list
{ text: ‘Product’, columntype: ‘dropdownlist’, datafield: ‘productname’, width: 177,
createeditor: function (row, cellvalue, editor) {
var dataSource = JSON;
editor.jqxDropDownList({source: dataSource });
}
}I have this column that I am trying to create a editor. The value of PriceType is a int and In my standalone test this works fine, I alert the index and value. When I am working in the grid the drop down does not display the value, but only the index. Here is my test code…
{ text: ‘PriceType’, datafield: ‘PriceType’, columntype: ‘dropdownlist’, width: 200, editable: true,
createeditor: function (row, cellvalue, editor) {
var source = {
datatype: “json”,
datafields: [
{ name: ‘Index’ },
{ name: ‘Value’ }
],
id: ‘id’,
url: ‘CompanyPriceTypeJSON.php’,
async: false
};
var dataAdapter = new $.jqx.dataAdapter(source);
editor.jqxComboBox({ selectedIndex: cellvalue, source: dataAdapter, displayMember: “Value”, valueMember: “Index”, width: 200, height: 25, theme: theme });
editor.bind(‘select’, function (event) {
if (event.args) {
var item = event.args.item;
if (item) {
return item.value;
}
}
});}
},Hi David,
We still do not have ComboBox editor. It will be available in jQWidgets 2.5 which is expected in the second half of this month. Because of that, your code will not work with the current version of jqxGrid. We will also add functionality to update the cell editor’s value before it is saved in the Grid. Looks like that’s what you try to do in your scenario.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.