This is a migrated thread and some comments may be shown as answers.

Changing column orders of the grids

4 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khushali
Top achievements
Rank 1
Khushali asked on 15 May 2012, 09:03 AM
Hi,

I have a kendo grid, and it's column definition is like this:

ColDef = [{
    field: "apple"
}, {
    field: "banana"
}, {
    field: "orange"
}, {
    field: "papaya"
}, {
    field: "grapes"
}];

Now, depending on certain conditions, i need to change the order of these columns. If the user selects "orange" from a drop down, i want that column to appear first and then the other columns. How can i achieve such functionality? please help.

Regards,
Khushali

4 Answers, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 24 May 2012, 10:41 PM
You could keep the configuration around, modifiy it, clean out the existing grid with $grid.empty() and then reinitialize the grid with your modified configuration: $grid.kendoGrid({...})
0
Ifdev02
Top achievements
Rank 1
answered on 01 Oct 2012, 09:17 AM
Hi
Could not use .empty() it trows exception
0
Nohinn
Top achievements
Rank 1
answered on 01 Oct 2012, 10:04 AM
Ifdev02, by any chance did you try to apply the empty function to the kendoGrid data?
The empty function must be applied to the dom element, if even doing it this way it throws an exception then the problem is that you may have not loaded jquery before using the function.
0
Ifdev02
Top achievements
Rank 1
answered on 01 Oct 2012, 06:47 PM
Hi 
I move up .empty() directly to dom element as you suggest and my misery resolved!
I am able to re template my grid as expected, I am hoping to turn in my project in time. Whoever you are you might have save one's life. 
Tags
Grid
Asked by
Khushali
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Ifdev02
Top achievements
Rank 1
Nohinn
Top achievements
Rank 1
Share this question
or