EasyUI 之datagrid 使用 【DataGrid屬性解釋】


可選的參數

DataGrid 屬性

覆寫了 $.fn.datagrid.defaults.

 

參數名 類型 描述 默認值
title string Datagrid面板的標題 null
iconCls string 在面板上通過一個CSS類顯示16x16圖標。 null
border boolean 設置面板是否具有邊框 TRUE
width number datagrid面板的寬度 auto
height number datagrid面板的高度 auto
columns array DataGrid列配置對象 null
frozenColumns array 凍結的列,被現實在左邊 null
striped boolean 設置是否讓單元格顯示條紋。默認false。 FALSE
method string 通過該方法類型請求遠程數據。默認post。 post
nowrap boolean 是否包裹數據,默認為包裹數據顯示在一行 TRUE
idField string 標識字段,或者說主鍵字段 null
url string 請求數據的URL. null
loadMsg string 加載數據時顯示的信息 Processing, please wait …
pagination boolean 是否顯示分頁工具欄 FALSE
rownumbers boolean    

 


DataGrid Columns 是一個數組對象, 數組里的對象也是一個數組,數組里的每一個小對象就是一個列字段,例如:
Column 屬性

columns:[[
{field:'itemid',title:'Item ID',rowspan:2,width:80,sortable:true},
{field:'productid',title:'Product ID',rowspan:2,width:80,sortable:true},
{title:'Item Details',colspan:4}
],[
{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:100},
{field:'status',title:'Status',width:60}
]]
名稱 類型 描述 默認值
title string 列字段要現實的名稱 undefined
field string 列字段 undefined
width number 寬度 undefined
rowspan number 單元格行數 undefined
colspan number 單元格列數 undefined
align string 文本對齊方式,同align屬性. undefined
sortable boolean 是否可以被排序. undefined
checkbox boolean 是否具有多選框 undefined

Events(事件)

Name Parameters Description
onLoadSuccess none 調用遠程數據成功是激活
onLoadError none 裝載錯誤時激活
onClickRow rowIndex, rowData 點擊一行時激活,參數包括:
rowIndex:點擊的行數,從0開始
rowData: 當前行的數據
onDblClickRow rowIndex, rowData 雙擊一行是觸發,參數包括:
rowIndex:點擊的行數,從0開始
rowData: 當前行的數據
onSortColumn sort, order 對一列進行排序時激活,參數包括:
sort:排序字段名稱
order: 排序規則,升序,降序
onSelect rowIndex, rowData 選中一行時激活,參數有:
rowIndex:選中的行數
rowData: 數據
onUnselect rowIndex, rowData 取消選中時激活,參數:
rowIndex:選中的行數
rowData: 數據

Methods(方法)

 

Name Parameter Description
options none 返回所有屬性
resize none 重置大小布局
reload none 重新加載數據
fixColumnSize none 調整列的大小
loadData param 裝載數據,以前的數據會被移除
getSelected none 返回選中的行,沒有則返回空
getSelections none 返回所有的行,空則返回空數組
clearSelections none 取消所有選中
selectRow index 選中一行,參數為行號
selectRecord idValue 根據主鍵查詢出一條記錄
unselectRow index 取消選中一行


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM