UltraGrid Column Chooser

Posted by Admin on 28-Apr-2009 06:03

Hi,

I have an IG UltraGrid which calls "UltraGrid1:ShowColumnChooser("Choose display columns...")."

My UltraGrid is being built from a temp-table and dynamic query:

    CREATE QUERY qh.           
       
    qh:SET-BUFFERS(bh).
       
    qh:QUERY-PREPARE("FOR EACH ttTable").
       
    bindingSource1:HANDLE = qh.

What I would like to do after a user changes the visible columns in the Grid, via the column chooser, is to determine which columns are now visible in the grid

and pass a modfied version of my temp table with just the visible columns to another application (UtraChart).

Is it possible determine which columns are visible?

Thanks in advance for any help you may be able to provide :-)

Mark.

All Replies

Posted by Admin on 28-Apr-2009 06:20

Since you're grid is bound to a Query, it's rather simple - that means you are dealing with a single band only.

Try:

DO i = 0 TO ultraGrid1:DisplayLayout:Bands[0]:Columns:Count - 1:

  IF ultraGrid1:DisplayLayout:Bands[0]:Columns[i]:Hidden = FALSE THEN

    MESSAGE ultraGrid1:DisplayLayout:Bands[0]:Columns[i]:Key "is not hidden"

        VIEW-AS ALERT-BOX.

END.

Posted by Admin on 28-Apr-2009 07:32

Hi Mike,

thanks for the reply. Unfortunately I can't find the "Hidden" or "Key" properties for the

Infragistics.Win.UltraWinGrid.ColumnsCollection object? Consequently it won't compile.

I wonder if I have a different version of the IG .net objects to yourself?

I'm using "NetAdvantage for .NET 2009.1"

Thanks.

Mark

Posted by Shelley Chase on 28-Apr-2009 08:06

Hi Mark,

In 10.2A the Visual Designer itself loads an Infragistics 8.1 control. The Microsoft CLR will only load one version of a set of controls. So I suspect even though you toolbox has a 9.1 UltraGrid, the 8.1 UltraGrid is actually what is being used. To test this you could close all Visual Designers and restart the OpenEdge runtime. Open the form in the text editor and compile. As long as your assemblies.xml has references to the 9.1 controls it should compile.

This has been addressed in 10.2B. Feel free to log a bug against 10.2A.

-Shelley

Posted by Admin on 28-Apr-2009 08:09

Hi,

think I solved it with this:

    DO i = 0 TO UltraGrid1:DisplayLayout:Bands[0]:Columns:Count - 1:
     
      IF UltraGrid1:DisplayLayout:Bands:Item[0]:Columns:Item[i]:Hidden = FALSE THEN
        MESSAGE UltraGrid1:DisplayLayout:Bands:Item[0]:Columns:Item[i]:Key
        VIEW-AS ALERT-BOX.

    END.

Posted by Admin on 28-Apr-2009 13:18

That's strange.

I must admit, that I wrote the code from my previous post without trying it in the Progress compiler. I just tested it now. It works for me exactly (copy and paste from this thread) as I posted it earlier.

By using the Bands[0] and Columns[i] I'm using the default indexer of the Bands- and ColumnsCollection. When you look at both Collection types, the Item[integer] returns a Band and Column.

Did you actually try my code or did you try to reproduce it just using the class browser?

Posted by Admin on 29-Apr-2009 03:10

Hi,

Yes, I copied the code "as is" from your thread (after obviously defining i ).

As it turns out the problem was the fact that there were "bad" characters when I performed the copy and paste.

Once I'd removed them the code, as you wrote it, works fine.

Thanks.

This thread is closed