- Home
- Forum
- LightSwitch HTML
- foreign key field in non editing grid shows summary fields from main table
foreign key field in non editing grid shows summary fields from main table
Thanks for your interest in Syncfusion products.
We have analyzed the reported query and have viewed the video that you have shared with us.
We suspect that by foreign key field, you mean complex type field such that the field Mandant has two properties Name and aktiv. Hence the type of the column in the lightswitch screen page(BrowseFirmen.lsml) is displayed as summary.
When binding a complex type field to the grid, we need to specify the field name as in the below code snippet.
|
itemTemplate.ejGrid( { dataSource: dataManager, allowSorting: true, allowPaging: true, columns: [ { field: "ID", headerText: "ID", isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 90 }, { field: "Company", headerText: 'Company', width: 90 }, { field: "Address", headerText: 'Address', width: 90 }, { field: "TaxNumber", headerText: 'Taxnumber', width: 90 }, { field: "Website", headerText: 'Website', width: 150 }, { field: "PostalNumber.PostalNr", headerText: 'Postalnumber', width: 90 }, { field: "City.Code", headerText: 'City', width: 90 } ], actionComplete: function (args) { if (args.requestType == "save") myapp.applyChanges(); }, }); { ID: 10248, Company: "VINET", Address: 5, Website: "Vins et alcools Chevalier", TaxNumber: 32.38, PostalNumber: { PostalNr: "51100" }, City: {Town:"Reims", Code:"042"}} |
For your convenience, we have created a sample with complex binding and the same can be downloaded from the below location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/119805/ze/LightSwitchDropdownData1835034065
Please get back to us if you need any further assistance.
Regards
Ragavee U S
We have analyzed your query.
Based on your requirement, we have modified the code to append the table name with the fieldName thus handling the issue reported. Please refer the below code snippet.
|
for (i = 0; i < first.children.length; i++) { if (ej.isNullOrUndefined(first.children[i].valueModel.elementType)) //checking if the field is of complex type fieldname[i] = { field: first.children[i].valueModel.name, width: 100 }; else { fieldname[i] = { field: first.children[i].valueModel.name + "." + first.children[i].valueModel.elementType[":@SummaryProperty"].property.name, width: 100 };//merge the table name with the summary property of the table and assign it as fieldName } |
In the above snippet, we have checked if the field is complex and thus obtained the summary property of the field and appended it with the table name. The above code snippet will work dynamically for all control types for the corresponding field.
For your convenience, we have modified our previously updated sample with the above solution and the sample can be downloaded from the below location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/119805/ze/LightSwitchDropdownData_Modified-961726019
Please get back to us if you need any further assistance.
Regards
Ragavee U S
- 3 Replies
- 2 Participants
-
TS Thomas Steschulat
- Aug 3, 2015 10:46 PM UTC
- Aug 10, 2015 10:51 AM UTC