Community Tip - You can change your system assigned username to something more personal in your community settings. X
I want to save the data I bound to the grid while some (not all) rows users can edit.
I need to save both edited and unedited rows. currently, I'm getting only those rows that are edited. I need all the grid data. My Thingworx version is 9.3.3-b20.
if anyone know how to achieve it please help.
Since you are populating the grid, that means you know the 'original state' then you combine that with the 'edited rows'
You should be able to use the infotable functions or if the data is in a datatable, you can use datatable functions for that server side.
After that you can return the new full grid set.
I thought the same solution for it but iterating over info table data , recognizing edited rows then replacing those seems not efficient. can you please help if you know any info table function that can do it efficiently or with fewer lines of code? I tried the OOTB snippet "Union" but it doesn't work.
You'll have to doublecheck, but I think a DataTable supports 'Update Query' I don't remember if that is possible for an infotable as well (or the other way around).
I tried the UpdateQuery snippet under infotable functions, but using that snippet gives me only those rows which I have edited.
I need all unedited rows and edited rows with updated values.
What does your actual code look like?
Please find below code
//make query**************
let queryArray=[];
editedData.rows.toArray().forEach(row => {
//Your code here
let filterItem= {
"fieldName": "id",
"type": "LIKE",
"value": row.id
};
queryArray.push(filterItem);
});
let query={
"filters": {
"type": "OR",
"filters":queryArray
}
};
logger.error(JSON.stringify(query));
//@@@@@@@@@@@@@@@@@@@@@@@@
let params2 = {
t:editedData INFOTABLE,
query: query QUERY,
values: inputData INFOTABLE
};
// result: INFOTABLE
result = Resources["InfoTableFunctions"].UpdateQuery(params2);
What if you set editedData to result after executing the update query?
like:
Resources["InfoTableFunctions"].UpdateQuery(params2);
result = editedData