Skip to main content
1-Visitor
June 28, 2016
Solved

do not show all datatable fields in grid

  • June 28, 2016
  • 3 replies
  • 4290 views

Hi!

When i create a DataTable and show the content in a Grid there are some pre-defined fields like Location, Source etc.

In some cases i don't want to  show all the columns in a Grid only a set of them. Is there a way to acomplish this in Thingworx?


Thanks

Best answer by AdamR

You can also use the RemoveField function for an Infotable after doing the query.  From our doc...

RemoveField(fieldName)

Removes this field from the Infotable data shape (fields collection).

So you could call...

infoTableName.RemoveField(location);

infoTableName.RemoveField(source);

...

3 replies

14-Alexandrite
June 28, 2016

You can select the Configure Grid Columns option from the dropdown menu at the top left of the widget when it is selected in Composer design.  This allows you to select visibility, order, heading and styling of each grid column.

rmórocz1-VisitorAuthor
1-Visitor
June 28, 2016

Thanks Adam, i will check, but to have only the required columns would be better than hide them in the grid.

1-Visitor
June 28, 2016

You should write a service which returns only the desired fields.

rmórocz1-VisitorAuthor
1-Visitor
June 28, 2016

This was my original idea, but the way to do it is not clear.

I can create an infotable and define another datashape and fill in de required data from the datatable into the infotable row by row, but it looks odd, to do it that way.

Do you have another idea how to do it?

1-Visitor
June 28, 2016

You don't need to create a new infotable, you query the DataTable from the service and you can remove the undesired fields ( there's snippets to do it )

rmórocz1-VisitorAuthor
1-Visitor
June 28, 2016

Looks good, will check tomorrow.

Thanks