EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: stephenl on March 27, 2016, 08:14:54 AM



Title: Nested Subgrids - Using External data
Post by: stephenl on March 27, 2016, 08:14:54 AM
Hello

I am trying to build an Nested Grid ui based upon the example here
http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=

I have succesfully modified the code to use external data for the main grid, however I am having problems getting external data for the subgrids....in my application this data would be based upon 2 of the fields from the main grid, say company and contact..

I have tried addining a url: however this would also need 2 parameters company and contact, based upon the selection from the main grid

I think the "foreignField:" may have something to do with this, but carn't seem to find an explanation of its use

Any suggestions would be appreciated

Thank you




Title: Re: Nested Subgrids - Using External data
Post by: jarry on March 28, 2016, 12:28:46 AM
The 'foreignField' property value can be a string or a function. When set as a function, it must return the object that will be set as the query parameter values. Be sure to download the newest 'datagrid-detailview.js' file from http://www.jeasyui.com/extension/datagridview.php.
Code:
//foreignField:'companyid',
foreignField:function(prow){
    return {
        contact:prow.contact,
        company:prow.company
    }
},


Title: Re: Nested Subgrids - Using External data
Post by: stephenl on March 28, 2016, 12:27:54 PM
How did I miss that explanation....!- Thank you !