Columns Extension for DataGrid

Extension » Columns Extension for DataGrid

Include 'columns-ext.js' file

Events

The events extend from datagrid, below is the added events for datagrid.

Name Parameters Description
onBeforeDragColumn field Fires before drag a column, return false to deny drag.
onStartDragColumn field Fires when start dragging a column.
onStopDragColumn field Fires when stop dragging a column.
onBeforeDropColumn toField, fromField, point Fires before dropping a column, return false to deny drop.
toField: The column being targeted for the drop.
fromField: the source column.
point: indicate the drop operation, posible values are: 'before' or 'after'.
onDropColumn toField, fromField, point Fires when dropping a column.
toField: The column being targeted for the drop.
fromField: the source column.
point: indicate the drop operation, posible values are: 'before' or 'after'.

Methods

The methods extend from datagrid.

Name Parameter Description
columnMoving none Enable the column moving. This method allows the user to drag and drop the columns.
freezeColumn field Freeze a column.
unfreezeColumn field Unfreeze a column.
moveColumn param Move a column.

Code example:

$('#dg').datagrid('moveColumn', {
	field: 'itemid',
	before: 'listprice'
	// after: 'listprice'
});
reorderColumns fields Reorder the columns.

Code example:

$('#dg').datagrid('reorderColumns',['listprice','productid'])

Download the EasyUI Extension:

columns-ext.zip