jQWidgets Forums
jQuery UI Widgets › Forums › Grid › DropdownList using valueMember vs DisplayMember
Tagged: DropDownList, grid
This topic contains 4 replies, has 3 voices, and was last updated by Peter Stoev 12 years, 2 months ago.
-
Author
-
I have a grid loaded from some JSON data. One of the fields loaded uses the ID from another table in the database and I want to use a dropdownlist at that location in the grid. right now it renders the ID of the field vs the appropriate value from the dropdownlist. How do I best accomplish this, if it is possible.
I do have a dropdownlist working temporarily from an array using this code:
{ text: ‘Housing’, dataField: ‘HID’, minwidth: 150, columntype: ‘dropdownlist’, createeditor: function (row, hid, editor) {
var dataSource = [ { hid: 36, text: ‘Cappuccino’ }, { hid: 40, text: ‘Caramel Latte’ }, { hid: 170, text: ‘Caffe Espresso’}];
editor.jqxDropDownList({source: dataSource, displayMember: ‘text’, valueMember: ‘hid’ });
} },
and the text appears with no problem, but it is definitely not doing what I expect and that is to replace the hid with the text.Do I have to do something custom?
Thanks for any help.
DanielHi Daniel,
The displayMember and valueMember properties are applied only to the jqxDropDownList editor. The Grid columns do not have such properties and it is not possible to specify a display and value members. However, if you want to customize the displayed values, use the columns cellsrenderer function: jquery-grid-cellsrendering.htm
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks, it seems that if I provide the text value of the field that the dropdown at least selects it properly from the list. I’d still like to work with the ID numbers vs the textual description, but I might be able to make this work.
Hi Peter,
You said that displayMember and valueMember properties are applied only to the jqxDropDownList editor and not to Grid columns. Is it still applicable in the latest release (2.8) or have your team made it workable in the new release?Hi soonkoh,
This topic is created 10 months ago and is not valid anymore.
Please, take a look at the Grid’s Demos: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm and API Documentation. Especially this sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/gridkeyvaluescolumnwitharray.htm?classic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.