UltraGrid - Syntax Question

Posted by Roger Blanchard on 24-Feb-2009 09:54

Does anyone know the proper syntax to set the AllowRowFiltering to FALSE and runtime?

In InitializeComponent the following code is present.

DEFINE VARIABLE ultraGridColumn2 AS Infragistics.Win.UltraWinGrid.UltraGridColumn NO-UNDO.

ultraGridColumn2 = NEW Infragistics.Win.UltraWinGrid.UltraGridColumn("CommPerc").

ultraGridColumn2:AllowRowFiltering = Infragistics.Win.DefaultableBoolean:False.

The above line is present if I use the UltraGrid designer to set AllowRowFiltering to FALSE. However, using the designer is tedious and time consuming so I want to do this programatically and not quite sure how to reference the correct column.

All Replies

Posted by Admin on 24-Feb-2009 10:01

ultraGrid1:DisplayLayout:Bands[0]:Columns[0]

is the reference to the first column.

ultraGrid1:DisplayLayout:Bands[0]:Columns:Count returns the number of columns. Remember to loop from 0 to count - 1.

Posted by Roger Blanchard on 24-Feb-2009 10:16

Thanks Mike. Do you know if there is a way to reference by name?

Posted by Roger Blanchard on 24-Feb-2009 10:52

I guess this will do.

DO iColumn = 0 TO (gridItemGroup:DisplayLayout:Bands[0]:Columns:Count - 1):

IF LOOKUP(gridItemGroup:DisplayLayout:Bands[0]:Columns:ToString(),cList) GT 0 THEN gridItemGroup:DisplayLayout:Bands[0]:Columns:AllowRowFiltering = true.

END.

Thanks for the help Mike.

Posted by Admin on 24-Feb-2009 13:48

Hi Roger, I'd rather rely on specialized properties like Key in the case of an UltraGridColumn rather than the general purpose ToString() method.

For some classes the ToString() method returns something like Key or Text, for others the TypeName and for others a combination of different property values. Not very predictable and usually not well documented (and so you never know, if it might change).

Posted by Admin on 24-Feb-2009 13:49

ultraGrid1:DisplayLayout:Bands[0]:Columns works for me (character variable).

Posted by Roger Blanchard on 24-Feb-2009 14:00

Yes, it does here as well. I stumbled acrosss that when testing the looping. I kind of like the looping as I can set to TRUE/FALSE based on the field list I pass. I will have to look at Key and see if it works for what I am trying to do.

Thanks.

This thread is closed