jQuery UI Widgets Forums Lists ComboBox Data Binding Array

This topic contains 3 replies, has 3 voices, and was last updated by  Peter Stoev 8 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Data Binding Array #70723

    scarrier92
    Participant

    What I want to do is bind an array with changing data to a combobox.

    //dataadapter
    var column = new Array();
    
    	var sourceType =
    	{
    	localdata: column,
    	datatype: "array",
    	datafields:
    	[
    		{ name: 'TypeDeProtection', type: 'string' },
    	]
    	};
    	var dataAdapter2 = new $.jqx.dataAdapter(sourceType);
    				
    	$('#jqxComboBox4').jqxComboBox({source: dataAdapter2,displayMember: 'TypeDeProtection', multiSelect: true,   theme :'energyblue', width:700}); 
    
    //then I Change data
    		$("#jqxComboBox").on('change', function (event)
    		{
                                          var rows = $('#jqxgrid').jqxGrid('getdisplayrows');
    				for (var i = 0; i < rows.length; i++) {
    					var rowData = rows[i];
    					data[i]=rows[i]['TypeDeProtection'];
    				}
    				for (var i = 0; i < data.length; i++) {
    				var row = {};
    				row['TypeDeProtection'] =data[i];
    				column[i] = row;
    				}		});

    then how do I refresh data binding

    this dosen’t work
    $(‘#jqxComboBox4’).jqxComboBox(‘updatebounddata’);

    I would alo like to store selected items before ifd theuy are still there after data is reffresehd but What event should I use

    Data Binding Array #70738

    Peter Stoev
    Keymaster

    Hi scarrier92,

    There is no “updatebounddata” method in jqxComboBox so it would be strange if it had worked. To refresh the ComboBox’s data, the solution is to set it’s source property to point to new dataAdapter instance.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Data Binding Array #78722

    solobobo
    Participant

    Hi,

    Could you kindly let me know how this can be done specifically ?

    My single-page application is having 10+ comboboxes pointing to a single local array (backed by a data adapter) as data source.

    Regularly the data in this array will be refreshed and updated from the server, and I want all the linked comboboxes to have the source data updated.

    Please kindly let me know how this can be achieved.

    Thank you very much !

    Data Binding Array #78737

    Peter Stoev
    Keymaster

    Hi solobobo,

    As I wrote in the previous post, you need to set the “source” property to update the widget’s data source.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.