cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Specifying Selection Columns

Former Member
0 Kudos

Hi experts,

I'm trying to set dynamically igrid columns in java script:

document.DetailGrid.getQueryObject().setColumns("DateTime");

But it says there is not such method for QueryObject.

Is there anybody who knows right method?

Thank you..

-Ekrem

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

It is a Grid object, so the methods you need would be:

document.DetailGrid.getGridObject().setColumns("DateTime");

If you are working in MII 12.1, open the webpage in the Workbench. At the center of the bottom of the editing screen there are 5 dots. Click, hold, and drag up to open Script Assistant. It will help with the actual syntax you need.

Regards,

Mike

Former Member
0 Kudos

Hi,

Are you sure, there isn't such method for grid object? I also checked from

/XMII/Illuminator?service=admin&mode=Inspector&Name=iGrid

there is not setColumn method?

and also checked from script assistant. Thanks by the way for 12.1 tip.

0 Kudos

Looks like there is only setColumnHeaders for the GridObject.

The one way I know will work, but generally don't recommend it is to:

...getQueryObject().setQuery("Select ColumnA, ColumnB,... from TableOrViewA")

But I think you will see a bit of a performance hit. If you are selecting between only two or three layouts, you could change the Display Template object of the Grid Applet (or depending on your design, you could change both the query and display templates). That would have less impact and would be easier to maintain.

Regards,

Mike

Former Member
0 Kudos

I thought about this solution actually. But i saw this javascript method in MII book. Because of this i wanted to know, is there any method or not really avaliable. As i see, i will have to do it with another display template.

Thank you

-Regards

jcgood25
Active Contributor
0 Kudos

document.iGrid.getGridObject().setDisplayColumns("A,B,C")

This method will force the grid to only show the columns you provide (of course they must be returned in the query results). If the query returns additional columns they will not be visible unless you use the right click menu and request the data details.

0 Kudos

Thanks Jeremy. Missed that when I was in the script assistant.

Answers (0)