jQuery UI Widgets › Forums › General Discussions › Lists › ComboBox › item value is undefined
Tagged: displayMember, jqxComboBox, valueMember
This topic contains 2 replies, has 2 voices, and was last updated by ivailo 10 years, 11 months ago.
-
Authoritem value is undefined Posts
-
Hello,
i am facing an issue.on comboBox item select, <input type=”hidden” value=””> is empty. here is my code:function addGroup(){ var source = { datatype : "json", datafields : [ { name : 'id' }, { name : 'label' } ], url : "groupList", async:true }; var vehicleGroupDataAdapter = new $.jqx.dataAdapter(source); $('#jqxWidgetGroupType').jqxComboBox({selectedIndex: -1,theme:"summer", source: vehicleGroupDataAdapter, displayMember: "label", valueMember: "id", height: 26, width: "90%"}); $('#jqxWidgetGroupType').on('select', function (event) { var args = event.args; if (args) { var item = args.item; console.log(item); } }); }the console.log(item) give me the following result:
group: “”
groupHtml: “”
hasThreeStates: false
height: 22
highlighted: false
html: “”
index: 3
initialTop: 66
isGroup: false
label: “group 4”
left: -0
originalItem: Object
id: 524
label: “group 4”
uid: 3
searchLabel: null
selected: false
title: “”
top: 66
value: undefined
visible: true
visibleIndex: 3
width: 121the provided json :
[{“id”:521,”label”:”group 1″},{“id”:522,”label”:”group 2″},{“id”:523,”label”:”group 3″},{“id”:524,”label”:”group 4″},{“id”:561,”label”:”mn”}]value is undefined …so in my action i dont get any value for the selected item… please help.
if i change valueMember to “label” instead of “id”.the combobox select work fine:
group: “”
groupHtml: “”
hasThreeStates: false
height: 22
highlighted: false
html: “”
index: 3
initialTop: 66
isGroup: false
label: “group 4”
left: -0
originalItem: Object
id: 524
label: “group 4”
uid: 3
searchLabel: null
selected: false
title: “”
top: 66
value: “group 4”
visible: true
visibleIndex: 3
width: 121Hi niangos,
With local data your code seems to work well. Here is the demo.
Try to update to the latest version 3.8.1Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.