JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › DataAdapter Second Level json datafields › Reply To: DataAdapter Second Level json datafields
May 20, 2020 at 12:25 pm
#100768
admin
Keymaster
Hi Gerhard,
With mapping, you can use:
var data = [ {text1: 'abcde', object: {num1: 123}}, {text1: 'abcde', object: {num1: 123}}, {text1: 'abcde', object: {num1: 123}}, {text1: 'abcde', object: {num1: 123}}, {text1: 'abcde', object: {num1: 123}}];Smart('#grid', class { get properties() { return { dataSource: new Smart.DataAdapter({ mapChar: '.', dataSource: data, dataFields: [ {name: 'text1', dataType: 'string'}, {name: 'num1', map: 'object.num1', dataType: 'number'} ] }), columns: [ { label: 'Text 1', dataField: 'text1' }, { label: 'Number', dataField: 'num1' }, ] } } });
Hope this helps.
Regards,
Peter
Smart UI Team
https://www.htmlelements.com/