jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts

  • benahod
    Participant

    I just realised that I forgot to define a displayfield object inside the columns object of the jqxgrid.

    By modifying the code to something like…

    /* some jqxgrid parameters - begin */
    columns: [
    {
    	text: 'Type',
    	width: 180,
    	datafield: 'totype_id',
    	columntype: 'dropdownlist',
            displayfield: 'typelabel', //<<-- This is the line I forgot to define.
    	createeditor: function (row, column, editor) {
    		// assign a new data source to the combobox.
    		editor.jqxDropDownList({ autoDropDownHeight: true, source: dataAdapterType, displayMember: 'label', valueMember: 'value' });
    	},
    	// update the editor's value before saving it.
    	cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
    		// return the old value, if the new value is empty.
    		if (newvalue == "") return oldvalue;
    	}
    }
    ]
    /* some jqxgrid parameters - end */

    We will got something like…

    Array
    (
        [0] => Array
            (
                [totype_id] => 3 /* this is the value */
                [typelabel] => Large /* this is the label */
            )
    
    )

    Now we got the value as totype_id and the label as typelabel.

    Case closed.

    Thank you very much!

Viewing 1 post (of 1 total)