jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid cell drop down edit
Tagged: dropdown editor, grid
This topic contains 9 replies, has 2 voices, and was last updated by dev_pepper 11 years, 6 months ago.
-
AuthorGrid cell drop down edit Posts
-
Hi,
Here is my grid cell drop down edit code..
For ajax call
var url = "itemStocks/get_all_item_stocks_for_select"; var dropDownListSource = { type : "GET", datatype: "json", datafields: [ { name: 'itemId' }, { name: 'itemName' } ], id: 'itemId', url: url }; var dropdownListAdapter = new $.jqx.dataAdapter(dropDownListSource, { autoBind: true, async: false });
For cell edit
{ text: 'Item Nmae',columntype: 'dropdownlist', datafield: 'itemName', width: 130, minwidth: 130,sortable:false, createeditor: function (row, cellvalue, editor, cellText, width, height) { editor.jqxDropDownList({ source: dropdownListAdapter, displayMember: 'itemName', valueMember: 'itemId', width: width, height: height, theme: theme, selectionRenderer: function () { return "Please Choose:"; } }); },
},
I have set valueMember propery.But it only returns displayMember not id.
How can i return id for edited element .
Thanks
Hi dev_pepper,
Please, see this sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/gridkeyvaluescolumnwitharray.htm?arctic. It shows how to implement DropDownList Editor with Key/Value fields.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comIs it not possible with json?.my grid is constructing from json.
Thanks
Hi dev_pepper,
It is possible with any of the supported data sources – xml, json, jsonp, csv, tsv, array.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI have tried with json.check my first discussion.have i done anythig worg.My problem it does not return value member parameter.
can you please help me to do it with json instead of array?Hi dev_pepper,
The Data Source Type is not important. I saw your code and as I see missing parts in it I suggested you to look the sample. Please, take a look at the sample in details if you would like to learn how to initialize jqxDropDownList editor from custom data source.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comNow I got id from my drop down key value pair set.but it has a problem.After i perform a cell edit,the cell vaue becomes id(like 1,2..) insted of item name (item1,item2..)
{ text: 'Item Name',columntype: 'template', datafield: 'itemName', width: 130, minwidth: 130,sortable:false, createeditor: function (row, cellvalue, editor, cellText, width, height) { // construct the editor. editor.jqxDropDownList({ source: getEditorDataAdapter(itemName), displayMember: 'name', valueMember: 'id', width: width, height: height, theme: theme, }); } },
Can you help me to fix this?
Thanks.Hi dev_pepper,
Unfortunately, I think that you still have not looked at the suggested sample. The column’s initialization in the provided code is missing the “displayfield” member as demonstrated in the sample.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter Stoev.
I added “displayfield” as my item name and “datafield” as my itemId but no use..iam trying with json..can you please give me an example with json?.
Thank you..
Great Thanks..It works for me..you people have done really great..
Thanks.
-
AuthorPosts
You must be logged in to reply to this topic.