Solved

Capture and reassign column order in Infragistics ultragrid

Posted on 2014-02-25
9
1,399 Views
Last Modified: 2014-05-21
Hi Experts,

Using Infragistics ultragrid, I need to allow user to change the column order, then capture this order, so user can return it to this order in future.

I can capture the column order in vb.net using:

For x = 0 To 100
             tmp = tmp & UltraGrid1.DisplayLayout.Bands(0).Columns(x).Key & ","
Next x

         Using writer As New IO.StreamWriter(fileNameOutput)
            writer.WriteLine(tmp)
            writer.Close()
        End Using

However, if I rearrange the columns in grid (by drag and drop) it does not change the column order.

How can I capture and reassign the actual visible order of columns?

Thanks Much
LBiederman
0
Comment
Question by:Larry Biederman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 15

Accepted Solution

by:
Ess Kay earned 500 total points
ID: 40013487
infragistics has a save feature. you need to save it to a file and load it next time the grid opens.
You also need to enable this feature



Me.ultragrid.DisplayLayout.Override.allowRowFiltering = true

DIM FILENAME = "c:\gridsettings.xyz"
 Me.ultragrid.DisplayLayout.Save(filename)
 Me.ultragrid.DisplayLayout.load(filename)


i use this when you leave and enter grid

    Private Sub ultragrid_Leave(sender As Object, e As System.EventArgs) Handles ultragrid.Leave
        Me.ultragrid.DisplayLayout.Save(filename)
    End Sub

Open in new window

0
 

Author Comment

by:Larry Biederman
ID: 40045965
Hi  esskayb2d,
Sorry for the delay in responding (was away from work).

I'll give a try this week and award points.

Thanks so Much,
Larry
0
 

Author Comment

by:Larry Biederman
ID: 40052373
Hi  esskayb2d,

Hurray!  That works fine!
Strangely, I had to omit:   Me.ultragrid.DisplayLayout.Override.allowRowFiltering = true
But when I used remaining code it works as advertized.
You will receive all 400 points for this.

One expansion to this question:
I looked at the actual file created and it is complex.
Anyway I can cause columns to be sorted alphabetically by column name?
Not field name (tag) but actual header caption.
I'm using VB.net 2013, and Infragistics 13.2 with its latest service pack.

I'll increase answer to 500 points if you also solve this.

Thanks Much,
Lbiederman
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 15

Expert Comment

by:Ess Kay
ID: 40054035
Sure. the sort will also be saved in the files.
Simply click the column you want sorted, click the collumn again to sort in reverse order. A third time will remove sorting
, and when its saved, you will see it in the file
(This requires that you allow sorting in the grid properties)

Anything you do with the grid will be saved, and it will look like that when loaded

furthermore, if you use one grid multiple times, you need to save files seperatly

IE,      
DIM gridtype as string
Private Sub getgridType() as string
return "c:\gridsettings" & gridtype & ".xyz"
End Sub

Private Sub a()
    gridtype =  "gridA"  
   ....ultragrid.datasource = somedatasource...
Me.ultragrid.DisplayLayout.load(getgridType())
End Sub

Private Sub b()
    gridtype =  "gridB"  
   ....ultragrid.datasource = somedatasource...
Me.ultragrid.DisplayLayout.load(getgridType())
End Sub

 Private Sub ultragrid_Leave(sender As Object, e As System.EventArgs) Handles ultragrid.Leave
        Me.ultragrid.DisplayLayout.Save(filename)
 End Sub

Open in new window

0
 

Author Comment

by:Larry Biederman
ID: 40055364
Thanks for response!

What I desire to do is have a button I can click on, that will save the entire grid, alphabetically, in order of 'header captions'.
So if column header captions are currently ordered:  "lastname", "firstname", "address", the user can click a button to save (then recall),
the columns so they appear in alphabetical order:  "address", "firstname", "lastname" (alphabetical order).

In other words.. is there a way to display the entire grid, sorted by column headers, in alphabetical order?
Don't want to do manually, but with a click or two.

Thanks much for your expertize !!

lBiederman
0
 

Author Comment

by:Larry Biederman
ID: 40055368
Points increased to 500.
Thanks!
0
 

Author Closing Comment

by:Larry Biederman
ID: 40068198
Never heard back about how to alphabetize.
However, the original question was answered with excellent solution.

Thanks, Lbiederman
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 40068605
Sure. the sort will also be saved in the files.


But user will have to click the header at least once to set the order, after that it will be auto


Or, you can specify that in your SQL query or datasource  :
Order BY column1, column2 column3 desc

Open in new window


However, if you do the order in the backend, and user sorts by a column, the column with overwrite the backend sort, the frontend sort will take presidence
0
 

Author Comment

by:Larry Biederman
ID: 40080759
I can make this work!
Thanks again - 500 points were awarded.

Thanks, Lbiederman
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question