Author Topic: Change column order  (Read 2748 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Change column order
« on: October 12, 2016, 07:43:38 pm »
Hi

How can I change the column order after initialization?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change column order
« Reply #1 on: October 13, 2016, 04:46:52 pm »
1. colModel is just an array of columns, you can reorder the columns by manipulation of array items with javascript methods like splice.

2. refresh colModel.
Code: [Select]
  grid.option( 'colModel', grid.option( 'colModel') );

3. refresh grid.
Code: [Select]
  grid.refresh();
« Last Edit: October 13, 2016, 04:49:08 pm by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Change column order
« Reply #2 on: October 14, 2016, 03:36:53 pm »
Thank you.
I also use the show/hide columns feature and since I modify colModel I need to refresh that...How would that be done?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change column order
« Reply #3 on: October 24, 2016, 07:33:11 am »
Please follow steps 2 and 3 after modifying colModel.