jQWidgets Forums

jQuery UI Widgets Forums Vue my grid return [object Object], return nothing..

This topic contains 4 replies, has 2 voices, and was last updated by  Martin 4 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • gy.lee
    Participant

    json file

    
    data = {
    "information1":true,
    "information2":[1],
    "information3":[{
        "name":1,
        "type": "computer"
    },{
        "name":1,
        "type": "computer",
        "grouplist":[ 0, 0, 0, 0, 0, 0, 0, 0 ]
    }],
    "information4":{
        "content":[{ "id": "1", "no": "1},
                   { "id": "2", "no": "2"}],
        "first":"true"
    }
    }
    

    vue file

    
    data: function () {
    			return {
    				datas: null,
    				getWidth: '100%',
    				dataAdapter: new jqx.dataAdapter(this.source), //dataAdapter
    				columns: [
    					{text: 'information4', datafield: 'information4'},
    					{text: 'name', datafield: 'name'},
    					{text: 'id', datafield: 'id'}
    				]
    			}
    		},
    		beforeCreate: function () {
    			this.source = {
    				datatype: 'json',
    				mapChar: '>',
    				datafields: [
    					{name: 'information4', map: 'information4'}, // [object Object]
    					{name: 'content', type: 'array', map: 'information4>content'},// show nothing
    					{name: 'name', map: 'information4>content>name'},// show nothing
    					{name: 'information3', type: 'array'},// show nothing
    					{name: 'id', type: 'number', map: 'information3>id'} // show nothing
    				],
    				root: 'data',
    				url: '/configure/test_list.json',
    				pagenum: '0',
    				pagesize: '20',
    				data: 
    					{
    						network_id: "1",
    						term_type: "2h"
    					}
    			};
    
    		},
    

    Martin
    Participant

    Hello gy.lee,

    You should not pass objects in the datafields. You can map their properties.
    I would suggest you to check this Topic about Grid’s Data Source.

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com


    gy.lee
    Participant

    hello martin!

    
    data: function () {
    			return {
    				datas: null,
    				getWidth: '100%',
    				dataAdapter: new jqx.dataAdapter(this.source), //dataAdapter
    				columns: [
    					{text: 'id', datafield: 'id'}
    				]
    			}
    		},
    		beforeCreate: function () {
    			this.source = {
    				datatype: 'json',
    				mapChar: '>',
    				datafields: [
    					{name: 'content', type: 'array', map: 'information4>content>0>id'}
    				],
    				root: 'data',
    				url: '/configure/test_list.json',
    				pagenum: '0',
    				pagesize: '20',
    				data: 
    					{
    						network_id: "1",
    						term_type: "2h"
    					}
    			};
    
    		},
    

    i understand how to work map..
    but i want every id result in grid. that code is work but result is just 1!
    how can i return every id in information4>content?
    this is what i want
    |id|no|
    |1|1|
    |2|2|


    gy.lee
    Participant

    ..if root is content result is what i want
    but i use other information in my grid.. so root is must be data.
    please help me.. ㅠㅠ


    Martin
    Participant

    Hello gy.lee,

    There is no such functionality in jqxGrid.
    The possible datafields’ types are: ‘string’, ‘date’, ‘number’, ‘float’, ‘int’, ‘bool’.

    You could check if a Nested Grid will work for you.

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.