This is a migrated thread and some comments may be shown as answers.
Odd behavior using hideColumn and reorderColumn together.
2 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 10 Jan 2012, 03:52 PM
I've run into some display issues using the hideColumn and reorderColumn client calls. 

Issue 1.

Trying to reorder columns in a random order does not work. Causes columns to disappear. 
grid.reorderColumn(3, grid.columnFromMember("Address"));
grid.reorderColumn(4, grid.columnFromMember("City"));
grid.reorderColumn(2, grid.columnFromMember("Zip"));
grid.reorderColumn(0, grid.columnFromMember("State"));
grid.reorderColumn(1, grid.columnFromMember("Name"));

If I work from the last column forward, always placing the the column at the front this works.
grid.reorderColumn(0, grid.columnFromMember("City"));
grid.reorderColumn(0, grid.columnFromMember("Address"));
grid.reorderColumn(0, grid.columnFromMember("Zip"));
grid.reorderColumn(0, grid.columnFromMember("Name"));
grid.reorderColumn(0, grid.columnFromMember("State"));

Is this the expected use of reorderColumn?

Issue 2:

Trying to reorder columns again after hiding some columns also has issues. 

Step 1. Reorder Columns (Using working around from Issue 1)
grid.reorderColumn(0, grid.columnFromMember("City"));
grid.reorderColumn(0, grid.columnFromMember("Address"));
grid.reorderColumn(0, grid.columnFromMember("Zip"));
grid.reorderColumn(0, grid.columnFromMember("Name"));
grid.reorderColumn(0, grid.columnFromMember("State"));

Step 2: Hide 2 Columns
grid.hideColumn("Zip");
grid.hideColumn("Address");

Step 3a: Trying to reorder the remaining visible columns (using workaround from issue 1) causes columns to disappear
grid.reorderColumn(0, grid.columnFromMember("State"));
grid.reorderColumn(0, grid.columnFromMember("Name"));
grid.reorderColumn(0, grid.columnFromMember("City"));

Step 3b. If I account for hidden columns though and reorder them explicitly to the end of the grid this works. 
grid.reorderColumn(0, grid.columnFromMember("Zip"));
grid.reorderColumn(0, grid.columnFromMember("Address"));
 
grid.reorderColumn(0, grid.columnFromMember("State"));
grid.reorderColumn(0, grid.columnFromMember("Name"));
grid.reorderColumn(0, grid.columnFromMember("City"));

I found that if i don't perform the initial reorder (step 1) then Step 3a will work. 

Attached is an example project that shows these examples.

2 Answers, 1 is accepted

Sort by
0
Ian
Top achievements
Rank 1
answered on 23 Jan 2012, 05:14 PM
I've run into similar issues when trying to use this method. Could someone from the MVC team please shed some light on how this method is intended to be used?
0
Petur Subev
Telerik team
answered on 25 Jan 2012, 11:03 AM
Hello guys,

The reorderColumn is not considered to be part of the public API and it is intended for internal use. If you still want to make use of it you need to check if the index representing the new position of the column is not the same as the current index, because this will make your column disappear.


Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Ian
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or