jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox item value is undefined

This topic contains 2 replies, has 2 voices, and was last updated by  ivailo 9 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • item value is undefined #73669

    niangos
    Participant

    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: 121

    the 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.

    item value is undefined #73673

    niangos
    Participant

    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: 121

    item value is undefined #73676

    ivailo
    Participant

    Hi niangos,

    With local data your code seems to work well. Here is the demo.
    Try to update to the latest version 3.8.1

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.