接着前几天做的工作,今天上午完成了定制字段,思路是在上面的普通查询或者高级查询结束以后,获得了列的fields,columns等信息,然后交给一个处理函数 makeCustomMadePanel,该函数用来生">
Home >Web Front-end >JS Tutorial >How ExtJS4 automatically generates checkbox_extjs that controls grid column display and hiding
For some reason, I need to make a checkboxgroup that controls the display of grid columns. Although the gridpanel in EXTJS4 comes with a list that can control the display and hiding of columns, there is such a demand (it needs to be clear at a glance)
The following picture is shown below
Following the work done a few days ago, I completed the custom fields this morning. The idea is to obtain the fields and columns of the column after the above ordinary query or advanced query is completed. Wait for the information, and then hand it over to a processing function makeCustomMadePanel. This function is used to generate the checkboxgroup. When generating it, add an event to it. I originally thought that the checkbox would have an event similar to check. However, after looking at the API, it seems that there is only a change event. Use, MD. .
Post the makeCustomMadePanel function I wrote below. . Used to automatically generate a checkboxgroup based on the columns of the grid (the header content and other information of the entire grid are obtained from the background. No matter what table is sent from the background, a checkboxgroup can be generated to control the hiding and display of the columns)
parameters They are fields and columns used by gridpanel during reconfigure. The key is var t=grid_a.columnManager.headerCt.items.get(th.itemId); in the period. . This sentence is used to obtain the column information of grid_a. . It seems that it cannot be found in the api. I found several methods online but none of them were suitable. I don't want to give each column an ID. This was found on stackoverflow.com/. . http://stackoverflow.com/questions/20791685/extjs-4-how-do-i-hide-show-grid-columns-on-the-fly