Dynamic change DataGrid columns

Tutorial » Dynamic change DataGrid columns

The DataGrid columns can be defined using 'columns' property easily. If you want to dynamically change the columns, that's no problem at all. To change columns you can recall the datagrid method and pass a new columns property.

Create DataGrid

Run the web page and you will see:

Sometimes you want to change the columns, so you can write some code:

Remember we have defined other properties such as url,width,height,etc. We don't need to defines them again, we define what we want to change.

Download the EasyUI example:

easyui-datagrid-demo.zip