1

When implementing widgets in my Gridx Layout I am running into an issue.

I have data coming from the database which in turn is sending me info similar to this.

[{id:"1234567",ParamName:"Host",defaultValue:"localhost",type:"text"},
{id:"1234567",ParamName:"Secure",defaultValue:"true",type:"checkbox"}]

I need to change the widget type in the cell of Gridx dynamically based off of the type field in the data row.

All examples I have seen only give the ability to have a column be one widget type.

1 Answer 1

0

When showing a grid of data, one expects all the columns in the grid to be of the same type. In your example, I am not sure what you would call the column that sometimes is called "host" and sometimes called "Secure". The GridX technology provides a mechanism for view the data in column using a specified viewer ... it isn't configurable on a cell by cell basis. If you feel you really need such a thing, maybe create a new type of Dijit widget that takes a value and a "type" and register that Widget as the decorator. The widget can then examine its type and visualize the data appropriately.

However my gut is telling me that a "table" may not be the desired layout. What about defining columns for all the possible data returned ... for example "Host" and "Secure" and when the data comes back from the database, massage that data into a new store which has properties for each of the different "ParamName" possibilities. I could then imagine a row which has properties for:

  • Host
  • Secure

And your table would "look right".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.