jQuery UI Widgets Forums Plugins Data Adapter selected columns

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 8 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • selected columns #80871

    ziggy
    Participant

    Hi,

    Is there a way where I can get selected columns only from a source? Say I want to get columns A and B only.

    
    var data = '{"A":1899466,"B":"XDSF","C":EWWWWE,"D":"WERE","DATETIME":"2016-01-12 06:30:36","E":"YODA"}'
    
    var source =
                    {
                        datatype: "json",
                        datafields: [
                            { name: 'A'},
                            { name: 'B'}
                        ],
                        localdata: JSON.parse(data)
                    };
    
    var  dataAdapter= new $.jqx.dataAdapter(source,
    {
                       
                   loadComplete: function(records)
                        {
                            console.log(records);
                        }
    });
                  
    

    Thanks!

    selected columns #80896

    Hristo
    Participant

    Hello ziggy,

    var data = '{"A":1899466,"B":"XDSF","C":"EWWWWE","D":"WERE","DATETIME":"2016-01-12 06:30:36","E":"YODA"}'
    
     var source = {
     	datatype: "json",
     	datafields: [
            	{ name: 'A', type: 'number' },
            	{ name: 'B', type: 'string' }
        	],
        	localdata: JSON.parse(data)
     };
    
     var dataAdapter = new $.jqx.dataAdapter(source, {
     	autoBind: true,
     	beforeLoadComplete: function (records) {
            	console.log(records);
    
            	return records;
     	}
     });

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.