web component - How to sort the columns in the tool panel. Ag-Grid -


edit: found out move column doesn't work in v6.4.0

example link: https://www.ag-grid.com/javascript-grid-tool-panel/toolpanelexample.html

the order of columns visible in tool panel in same order defined in column definition. check image below.

the way shown in tool panel. want sort alphabetically

the order shown in grid

is possible sort them in tool panel in order(say alphabetically) without changing order shown in grid.

what tried:

i tried defining them in alphabetical order in columndefination , tried move them there position using columnapi.movecolumn(). doesn't seems work either increases complexity when have move columns , position them.

questions:

  1. is possible/feasible?
  2. the movecolumn() function not working. can tell in version introduced not able find in changelog.

additional details:

using ag-grid enterprise version v6.4.0

please refer this plnkr. used same basic idea had, creating coldefs in alphabetical order in ongridready function moved columns respective placements. there 2 functions useful in doing this, second preferable in opinion:

movecolumn(colkey, toindex) //colkey refers id of column defaults specified field //toindex number within range of columns.  movecolumns(colkeys[], toindex) //colkeys[] array in order want them   displayed starting @ toindex 

here how implemented in plnkr:

private onready() {      // this.gridoptions.columnapi.movecolumn('name',1)     // this.gridoptions.columnapi.movecolumn('country',2)     // this.gridoptions.columnapi.movecolumn('dob',3)     // this.gridoptions.columnapi.movecolumn('skills',4)     // this.gridoptions.columnapi.movecolumn('proficiency',5)     // this.gridoptions.columnapi.movecolumn('mobile',6)     // this.gridoptions.columnapi.movecolumn('landline',7)     // this.gridoptions.columnapi.movecolumn('address',8),      this.gridoptions.columnapi.movecolumns(['name', 'country', 'dob', 'skills', 'proficiency', 'mobile', 'landline', 'address'],1)  } 

there 1 more function available if use it:

movecolumnbyindex(fromindex, toindex) //this uses indexes , not colid/colkey idea if prefer   keep more anonymous  

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -