cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Advanced Grid : Row selection and Edit doesn't work simultaneously.

TanmeyTWX
17-Peridot

Advanced Grid : Row selection and Edit doesn't work simultaneously.

Hi Folks,

 

I came across a requirement to Edit grid row and meanwhile it should be selected as well but thats not working when using Advanced Grid. Once isEditable property is checked, SelectedRows stops working and viceversa.

I want to make grid Editable and row should be highlighted while editing. Also the selectedRow should also be used as an input for a service.

If anyone figured out any workaround for this, do share your ideas.

 

Thingworx version: 8.5.6.b110

 

TIA.

 

ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

Instead of calling DB everytime user edits grid, I have used a DT infotable which would AddDataTableEntries on popup open and Purge the same on popup close. And having a router with 2 inputs i.e. one from Main service and other from this DT, is finally doing the job.

View solution in original post

9 REPLIES 9
TonyZhang
15-Moonstone
(To:TanmeyTWX)

Hi @TanmeyTWX,

 

It is working to specification that IsEditable and RowSelection can not be simultaneously selected.

 

As a workaround, use EnableEditButton property with RowSelection instead of isEditable property.

With row(s) can be selected, the Grid editing is off.

Once Grid is in Editable mode by clicking the Edit button, row selection won’t be possible until Grid is non-editable.

 

Hope that helps.

Tony

Hi @TonyZhang 

 

Thanks for your reply. I guess I can use this workaround but I have got another issue with advanced Grid widget.

On load, Grid doesn't load particular entire column in edit mode but specific cell on click only unlike what was available in Thingworx 7 and previous version.

 

Issue description: If I have 3 rows in grid and tries to edit only one of them and use 'EditableTable' property to pass as an input for a service(refresh grid with edited value), it is always taking the edited row only instead of entire table.so when grid refreshes for edited values, it will not load all 3 rows again but one row.

 

Expectation: Grid should refresh with all the data even if only row gets edited.

 

attached is the screenshot of the same.

image a is before editing a value with total 3 rows

image b is after completing the edit with one row.

 

 

Any idea on this?

 

 

 

TonyZhang
15-Moonstone
(To:TanmeyTWX)

Hi @TanmeyTWX

 

Yes, EditedTable only returns the specific row being edited is an expected behavior instead of returning the entire table in newer releases now - not sure exactly when this behavior changed though.

You should not simply pass the EditedTable to overwrite the entire data source for update.

If you use Datatable as a data source, you can use predefined AddOrUpdateDataTableEntries service to update the edited row only.

If you use infotable type thing properties as a data source, you will need to create a service to find that particular row being edited and update the record.

Tony

Hi Tony,

 

Data source being used is a SQL based service which return infotable to the grid and SelectedRow won't work while in editable mode as we already discussed

And I have to update a column value based on another column value within the same grid.

 

Do you think if I can use Grid widget (deprecated) instead of Advanced Grid because that provides Editable and SelectedRow at same time?

TonyZhang
15-Moonstone
(To:TanmeyTWX)

Hi @TanmeyTWX,

 

Sure you can use Grid (deprecated) if the requirement really matters but as the name suggests it's deprecated and the Grid (deprecated) widget will probably soon be removed in newer version release. When you upgrade to that new release you will need to reimplement your mashup and logic all over again so it's not recommended.

 

By updating a column value based on another column value do you mean to update a column of the edited row? Could you elaborate on that? Is this the reason why you wish the EditTable returns the entire table instead of only the single edited row?

 

If Grid Advanced can achieve what you want to achieve, even it might need extra coding, I'd still recommend to use Grid Advanced widget.

 

Also may I know why requiring grid editing and row selection happen at the same time?

 

FYI, Grid (Preview) widget is introduced since ThingWorx 9.2 but the edit function is not completed yet. Once all the functions are ready and released for new Grid widget, that new Grid will probably take over Grid Advanced - Grid Advanced will then be deprecated in the future. 

 

 

 

Tony

Hi Tony,

 

I'm trying to achieve below functionality.

 

1. Grid loads with rows. lets say 3 rows.

TanmeyTWX_0-1634557610615.png

 

2. User edit one cell value but not all. lets say 3rd row -2nd cell.

TanmeyTWX_1-1634557770053.png

 

3. Click on Save. Now this entire table not only that row, should be passed to another service for some calculation and refreshed grid with new values.

 

 

TonyZhang
15-Moonstone
(To:TanmeyTWX)

Hi @TanmeyTWX

 

Assume you have

  • two identical TWX sql query services called "SelectTable1" & "SelectTable2" SELECT all Table entries from your SQL DB
  • a TWX sql command service called  "UpdateARecord" to UPDATE a record into your Table with matching primary key value
  • a TWX JavaScript service called "UpdateTable" using loop to call "UpdateARecord" service to update multiple records depending on the input
  • a TWX JavaScript service called "DoCalculation" to calculate and update some values in Grid

1. Bind SelectTable1 service output with the Grid

2. User update one cell value

3. Bind EditedTable to UpdateARecord service to update one record of the Table in SQL DB

4. In DoCalculation service, call SelectTable2 service to get the entire updated table entries from SQL DB and perform some calculations...

5. Pass the output of DoCalculation service to UpdateTable's input to update all the affected records in SQL DB with the newly calculated infotable

6. Run SelectTable1 service to refresh the grid display

 

I didn't exactly implement this in my local environment but I think this should work...

Hope that helps and not too confusing.

Tony

Hi,

 

Instead of calling DB everytime user edits grid, I have used a DT infotable which would AddDataTableEntries on popup open and Purge the same on popup close. And having a router with 2 inputs i.e. one from Main service and other from this DT, is finally doing the job.

TonyZhang
15-Moonstone
(To:TanmeyTWX)

Hi @TanmeyTWX,

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards,
Tony

Tony
Announcements


Top Tags