The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hi, All
I have one question on Thingworx9.2.0 as follows;
(1) Create a Infotable include 3 rows
(2) Create a mashup using AdvanceGrid and Infotable as follows
(3) Show the mashup then 3 rows are displayed on the AdvanceGrid.
(4) Edit a cell value.
(5) Immediately, other 2 rows are deleted from AdvanceGrid and Infotable.
(6) This is correct or something wrong?
Regards,
Solved! Go to Solution.
EditedTable Infotable from the grid contains only edited row values.
For example, if you have 3 rows and you are editing only the 2nd row. EditedTable will contain only the 2nd Row value and if you update the property value using the SetProperties service it will overwrite the previous value which contains all rows. That is the reason for other rows getting deleted.
To overcome this you can create a custom service that takes EditedTable value as input and updates only the affected row in the property without removing other rows.
Sample Code :
I have a dummy InfoTable property with 3 rows in it and name field is the primary key
Script to update only edited value
if(EditedTable)
{
// Get property data
let allData = me.dummyInfoTable;
// Iterate over editedTable Infotable
for(var i = 0; i < EditedTable.length; i++)
{
// get editedTable key value
var keyValue = EditedTable.rows[i].name;
// Iterate over allData InfoTable
for (var k = 0; k < allData.length; k++)
{
// get allData key value
var allDataKeyValue = allData.rows[k].name;
// update allData value with edit value if key matches
if(allDataKeyValue === keyValue)
{
allData.rows[k].description = EditedTable.rows[i].description;
break;
}
}
}
// Update property value
me.dummyInfoTable = allData;
}
var result = me.dummyInfoTable;
Sample Input :
Updated property value
/VR
EditedTable Infotable from the grid contains only edited row values.
For example, if you have 3 rows and you are editing only the 2nd row. EditedTable will contain only the 2nd Row value and if you update the property value using the SetProperties service it will overwrite the previous value which contains all rows. That is the reason for other rows getting deleted.
To overcome this you can create a custom service that takes EditedTable value as input and updates only the affected row in the property without removing other rows.
Sample Code :
I have a dummy InfoTable property with 3 rows in it and name field is the primary key
Script to update only edited value
if(EditedTable)
{
// Get property data
let allData = me.dummyInfoTable;
// Iterate over editedTable Infotable
for(var i = 0; i < EditedTable.length; i++)
{
// get editedTable key value
var keyValue = EditedTable.rows[i].name;
// Iterate over allData InfoTable
for (var k = 0; k < allData.length; k++)
{
// get allData key value
var allDataKeyValue = allData.rows[k].name;
// update allData value with edit value if key matches
if(allDataKeyValue === keyValue)
{
allData.rows[k].description = EditedTable.rows[i].description;
break;
}
}
}
// Update property value
me.dummyInfoTable = allData;
}
var result = me.dummyInfoTable;
Sample Input :
Updated property value
/VR
Hi, Velkmar
Thank you so much for your quick answer and accurate answer.
I am so grad to talk with you again.
best regards,