on 02-02-2022 12:08 PM
Hi,
We are developing an application were we needed to user crated data in an JavaScript array , and we want to save that data after user confirmation.
Is it possible to use an JavaScript array as ObjectTable target ?
Yes, you can use a data from an array as the source for an object table. The array should contain json objects. You will have to type in the binding names since the object browser won't have knowledge of the rule contents.
Here is an example rule and object table consuming it. You could also set the binding object to the array before navigating to the page and bind off the default object as an alternative.
Rule
/**
* Describe this function...
* @param {IClientAPI} context
*/
export default function GetObjectTableData(context) {
let data = [];
let item1 = {
'title': 'First Item',
'desc': 'My generated data item #1',
'status': 'New'
};
data.push(item1);
let item2 = {
'title': 'Second Item',
'desc': 'Another generated item',
'status': 'New'
};
data.push(item2);
return data;
}
Object Table
{
"_Type": "Section.Type.ObjectTable",
"Target": "/SalesOrder/Rules/GetObjectTableData.js",
"_Name": "SectionObjectTable0",
"Visible": true,
"EmptySection": {
"FooterVisible": false
},
"ObjectCell": {
"ContextMenu": {
"Items": [
],
"PerformFirstActionWithFullSwipe": true
},
"Title": "{title}",
"Subhead": "{desc}",
"Footnote": "{status}",
"DetailImageIsCircular": false,
"PreserveIconStackSpacing": false,
"AccessoryType": "none",
"Selected": false
},
"DataPaging": {
"ShowLoadingIndicator": false,
"PageSize": 50
},
"HighlightSelectedItem": false,
"Selection": {
"ExitOnLastDeselect": true,
"LongPressToEnable": "None",
"Mode": "None"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bill.froelich,
I have used the above approach. It's working but the search is not working. Any idea?
Thanks in advance !!
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.