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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Dynamic headers for the Grid - how did you do it?

VladimirRosu
19-Tanzanite

Dynamic headers for the Grid - how did you do it?

Hi all,

Anybody needed to programmatically generate a grid's header?

In my case I need the header to contain the starting week's calendar Day and Month, like 5-Dec, 12-Dec and so on, depending on the date I selected.

I'm aware of at least one method which can give nice results: not using a Grid, and replacing it with a Repeater.

However it requires a certain amount of implementation work.

Any other ideas?

Thanks,

Vladi

9 REPLIES 9

With standard Grid widget the only way to have "Dynamic" column it's to set it as "Show All Columns" and bind to a service which returns the desired columns.

Hy Carles,

Forgot to mention that one of my requirements is state based formatting on a cell basis

Well I have kind of state based formatting on cell basis still on a dynamic grid, but you need to have few fixed columns on the dynamic grid in order to set the State Based formatting on this fixed columns, but if you need state based formatting on the dynamic columns you are out of luck with standard Grid Widget, then you have two options the one you said a Repeater or customizing standard Grid Widget in order to support dynamic columns...

I was thinking of adding a new property to the grid, an Infotable, containing the names of the Headers, then modifying the runtime.js of the grid in order to display those instead of the datashape field names.

I think that this would be the, let's say, more correct way, what do you think?

Can be a way, but you will need a special format for that infotable where you define the mappings between DataShape field name and dynamic Column Name, something like placeHolder1 --> "My dinamic field Name".

Going to be bad and do it index-based ))

But index based will be super unrobust solution...

Hey, you're talking about being able to put state formatting on the "fix" columns in a dynamic grid.

How are you doing it ?

I have a service that has a basic shape as an output parameter.

In that service, I append more columns in the resultset. So the result doesn't have the same "shape" as the output parameter, since it has more columns.

Then if I link that output to a grid and click on show all. All my columns are there, great. But i cannot apply a state formatting to the fixed column I have.

Hi Frederik,

I have a row format not a column format, but it may work.

You can only relay on the basic shape column names to set the formatting, that's how I'm doing it, of course you can't base the format over the dynamic fields which are unknown at design time.

Hope it helps,

Carles.

Announcements


Top Tags