Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI Extension - DataGrid View

jQuery EasyUI Extension - DataGrid View (DataGrid View)


jQuery EasyUI Extensions jQuery EasyUI Extension


DataGrid DetailView (DataGrid DetailView)

Usage

Step 1: Create an HTML page



    

        

    

    

        
    

Step 2: Create a DataGrid



    $('#tt').datagrid({

        title:'DataGrid - DetailView',

        width:500,

        height:250,

        remoteSort:false,

        singleSelect:true,

        nowrap:false,

        fitColumns:true,

        url:'datagrid_data.json',

        columns:[[

            {field:'itemid',title:'Item ID',width:80},

            {field:'productid',title:'Product ID',width:100,sortable:true},

            {field:'listprice',title:'List Price',width:80,align:'right',sortable:true},

            {field:'unitcost',title:'Unit Cost',width:80,align:'right',sortable:true},

            {field:'attr1',title:'Attribute',width:150,sortable:true},

            {field:'status',title:'Status',width:60,align:'center'}

        ]],

        view: detailview,

        detailFormatter: function(rowIndex, rowData){

            return '' +

                    '' +

                    '' +

                    '
' +                     '

Attribute: ' + rowData.attr1 + '

' +                     '

Status: ' + rowData.status + '

' +                     '
';         }     });

property

Name Type Description Default value
detailFormatter function(index,row) A formatter function that returns the row detail content.

Events

Name Parameters Description
onExpandRow index,row Triggered when a row is expanded.
onCollapseRow index,row Triggered when a row is collapsed.

Method

Name Parameters Description
fixDetailRowHeight index Fix the height of the detail row.
getExpander index Get the row extension object.
getRowDetail index Get the row detail container.
expandRow index Expand a row.
collapseRow index Collapse a row.

DataGrid GroupView (DataGrid GroupView)

Usage

Step 1: Create an HTML page



    

        

    

    

        
    

Step 2: Create a DataGrid



    $('#tt').datagrid({

        title:'DataGrid - GroupView',

        width:500,

        height:250,

        rownumbers:true,

        remoteSort:false,

        nowrap:false,

        fitColumns:true,

        url:'datagrid_data.json',

        columns:[[

            {field:'productid',title:'Product ID',width:100,sortable:true},

            {field:'listprice',title:'List Price',width:80,align:'right',sortable:true},

            {field:'unitcost',title:'Unit Cost',width:80,align:'right',sortable:true},

            {field:'attr1',title:'Attribute',width:150,sortable:true},

            {field:'status',title:'Status',width:60,align:'center'}

        ]],

        groupField:'productid',

        view: groupview,

        groupFormatter:function(value, rows){

            return value + ' - ' + rows.length + ' Item(s)';

        }

    });

property

Name Type Description Default
groupField string Indicates the field to be grouped.
groupFormatter function(value,rows) A formatter function that returns the group content.
 value 参数指示由 'groupField' 属性定义的分组值。       

 rows 参数根据指定分组值指示数据行。 |  |

Method

Name Parameters Description
expandGroup groupIndex Expand a group.
collapseGroup groupIndex Collapse a group.

DataGrid BufferView (DataGrid BufferView)

Step 1: Include the 'datagrid-bufferview.js' file



    

        

    

Step 2: Create a DataGrid



    

        

            

                

                

                

                

                

                

                

            

        

    
Inv NoDateNameAmountPriceCostNote

DataGrid VirtualScrollView (DataGrid VirtualScrollView)

Step 1: Include the 'datagrid-scrollview.js' file



    

        

    

Step 2: Create a DataGrid using the virtual scroll view



    

        

            

                

                

                

                

                

                

                

            

        

    
Inv NoDateNameAmountPriceCostNote

Download the jQuery EasyUI example

jquery-easyui-datagridview.zip


jQuery EasyUI Extensions jQuery EasyUI Extension