Jquery datagrid 的属性、事件

Options

DataGrid Properties

Override default with $.fn.datagrid.defaults.

NameTypeDescriptionDefault
titlestringThe datagrid panel title text.null
iconClsstringA CSS class that will provide a background image to be used as the header icon.null
borderbooleanTrue to show datagrid panel border.true
widthnumberThe width of datagrid width.auto
heightnumberThe height of datagrid height.auto
columnsarrayThe datagrid columns config object, see column properties for more details.null
frozenColumnsarraySame as the columns property, but the these columns will be frozen on left.null
stripedbooleanTrue to stripe the rows.false
methodstringThe method type to request remote data.post
nowrapbooleanTrue to display data in one line.true
idFieldstringIndicate which field is an identity field.null
urlstringA URL to request data from remote site.null
loadMsgstringWhen loading data from remote site, show a prompt message.Processing, please wait …
paginationbooleanTrue to show a pagination toolbar on datagrid bottom.false
rownumbersbooleanTrue to show a row number column.false
singleSelectbooleanTrue to allow selecting only one row.false
fitbooleanTrue to set size to fit it's parent container.false
pageNumbernumberWhen set pagination property, initialize the page number.1
pageSizenumberWhen set pagination property, initialize the page size.10
pageListarrayWhen set pagination property, initialize the page size selecting list.[10,20,30,40,50]
queryParamsobjectWhen request remote data, sending additional parameters also.{}
sortNamestringDefines which column can be sorted.null
sortOrderstringDefines the column sort order, can only be 'asc' or 'desc'.asc

Column Properties

The DataGrid Columns is an array object, which element is an array too.
The element of element array is a config object, which defines every column field.
code example:

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}
]]
NameTypeDescriptionDefault
titlestringThe column title text.undefined
fieldstringThe column field name.undefined
widthnumberThe width of column.undefined
rowspannumberIndicate how many rows a cell should take up.undefined
colspannumberIndicate how many columns a cell should take up.undefined
alignstringIndicate how to align the column data. 'left','right','center' can be used.undefined
sortablebooleanTrue to allow the column can be sorted.undefined
checkboxbooleanTrue to show a checkbox.undefined

Events

NameParametersDescription
onLoadSuccessnoneFires when remote data is loaded successfully.
onLoadErrornoneFires when some error occur to load remote data.
onClickRowrowIndex, rowDataFires when user click a row, the parameters contains:
rowIndex: the clicked row index, start with 0
rowData: the record corresponding to the clicked row
onDblClickRowrowIndex, rowDataFires when user dblclick a row, the parameters contains:
rowIndex: the clicked row index, start with 0
rowData: the record corresponding to the clicked row
onSortColumnsort, orderFires when user sort a column, the parameters contains:
sort: the sort column field name
order: the sort column order
onSelectrowIndex, rowDataFires when user select a row, the parameters contains:
rowIndex: the selected row index, start with 0
rowData: the record corresponding to the selected row
onUnselectrowIndex, rowDataFires when user unselect a row, the parameters contains:
rowIndex: the unselected row index, start with 0
rowData: the record corresponding to the unselected row

Methods

NameParameterDescription
optionsnoneReturn the options object.
resizenoneDo resize and do layout.
reloadnoneReload the rows.
fixColumnSizenonefix columns size.
loadDataparamLoad local data, the old rows will be removed.
getSelectednoneReturn the first selected row record or null.
getSelectionsnoneReturn all selected rows, when no record selected, am empty array will return.
clearSelectionsnoneClear all selections.
selectRowindexSelect a row, the row index start with 0.
selectRecordidValueSelect a row by passing id value parameter.
unselectRowindexUnselect a row.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值