:: Forum >>

Is this feature is possible ?

Hi,

I use the sort feature on columns.

I would like to sort also by row on same grid, ie when I click on a row the
columns arrange in the order of cells values of clicked row.

Is it possible ?

Thanks.


JL2008
Wednesday, August 6, 2008
That should be possible. Unhide the row header (selector) with

grid.setSelectorVisible(true);

/aw.ui.grid/selector-visible.html

Then assign an event handler for selector click -

grid.onSelectorClicked = function(event, row){...};

/aw.ui.grid/selector-mouse-events.html

And then re-arrange the columns using setColumnIndices() method -

/aw.ui.grid/column-indices.html
Alex (ActiveWidgets)
Wednesday, August 6, 2008
Hi Alex,

Thanks for this idea, but is there an other method that not hide columns, a swap fonction for two columns ?

Thanks.
JL2008
Friday, August 8, 2008
Hi,

setColumnIndices can show all columns in a different order without hiding any columns.
The example on the page that Alex mentioned ( /aw.ui.grid/column-indices.html ) shows columns 2 and 0 and hides column 1.
If you use something like obj.setColumnIndices([2,0,1]) it will show column 2, then column 0 and then column 1
So, I think it can be used to sort the columns.

Ankur
Ankur Motreja
Friday, August 8, 2008
Hi Ankur,

Yes, it's okay for me.

But my problem is to re-order a row in fonction of the values of cells in this row, then that re-order also the columns ...

I don't want to hide columns ...

My table :

headers | col 1 | col 2 | col 3 | col 4 |
row 1 | aa | bb | cc | |
row 2 | dd | ee | | ff |
row 3 | | gg | hh | |

If I click on row 3, my table would be :

headers | col 2 | col 3 | col 1 | col 4 |
row 1 | bb | cc | aa | |
row 2 | ee | | dd | ff |
row 3 | gg | hh | | |

Because I have re-order my row 3 with values of row 3.
Then the cols have been re-ordered.

Thanks.


JL2008
Monday, August 11, 2008
Hi,

I have coded a solution that runs with setColumnIndices(), but I think a swap function between two columns will be an useful feature.

Thanks everybody for your help.
JL2008
Monday, August 11, 2008

This topic is archived.


Back to support forum

Forum search