Quantcast
Channel: XPages – Xcellerant
Viewing all articles
Browse latest Browse all 216

Dojo Data Grid – Part 6: Reordering Columns

$
0
0

Column reordering is a useful feature of a grid. If you provide the user the ability to rearrange the columns, you can create less views and grids in the application. There’s no property built into the dojo data grid to allow the user to reorder the columns, but it’s easy to add with a dojo attribute.

Dojo Data Grid Series

Reordering Columns

By default, Dojo Data Grid columns cannot be reordered, but it is an available feature of the dojo grid. All it requires is for the grid to have an attribute of columnReordering set to true. Fortunately, there is a way to add a dojo attribute.

Under All Properties > dojo > dojoAttributes, you can add a dojo attribute, set its name to columnReordering and set it’s value to true.

Grid6_1

This is what the attribute looks like in the page source:

<xe:this.dojoAttributes>
  <xp:dojoAttribute name="columnReordering" value="true"></xp:dojoAttribute>
</xe:this.dojoAttributes>

Now, if I want the lastname column to come before the firstname column in my grid, all I have to do is click on the column header and drag it to the left.

Grid6_2

And now the order has been changed.

Grid6_3

Up Next

In the next post, I’ll show what is required for sorting the grid and preventing sorting of specific columns or specific sort directions.



Viewing all articles
Browse latest Browse all 216

Latest Images

Trending Articles



Latest Images