yui datatable动态修改行号

相关函数


getRecord  :YAHOO.widget.Record getRecord ( row )
For the given identifier, returns the associated Record instance. 
 
传入RecordSet position Index或者Recod  Id 返回 该行的实例
 

 

  

updateCell:void updateCell ( oRecord , oColumn , oData , skipRender )
For the given row and column, updates the Record with the given data. If the cell is on current page, the corresponding DOM elements are also updated.
Parameters:
oRecord < YAHOO.widget.Record> Record instance.
oColumn < YAHOO.widget.Column | String | Number> A Column key, or a ColumnSet key index.
oData < Object> New data value for the cell.
skipRender < Boolean> Skips render step. Editors that update multiple cells in ScrollingDataTable should render only on the last call to updateCell().
更新cell,传入行实例,列实例,cell值。如果是scrolling table需特殊处理

 

getColumn: YAHOO.widget.Column getColumn ( column )
For the given identifier, returns the associated Column instance. Note: For getting Columns by Column ID string, please use the method getColumnById().
Parameters:
column < HTMLElement | String | Number> TH/TD element (or child of a TH/TD element), a Column key, or a ColumnSet key index.
Returns: YAHOO.widget.Column
Column instance.
传入index,id或者key获取列的实例
 

 

  其他行操作相关的用法见:yui-datatable常用知识总结

 

使用


 

var records = myTable.getRecordSet().getRecords();
var columnObject = myTable.getColumn("RN");
var  i, len,recordInstance ;
for( i=0,len=records .length; i<len; i++){
    recordInstance = myTable.getRecord(records[i].getId());
    myTable.updateCell(recordInstance,columnObject, i+1);
}

 

sortColumn


 

  排序行号:使用sortColumn方法:

  

sortColumn:void sortColumn ( oColumn , sDir )
Sorts given Column. If "dynamicData" is true, current selections are purged before a request is sent to the DataSource for data for the new state (using the request returned by "generateRequest()").
Parameters:
oColumn < YAHOO.widget.Column> Column instance.
sDir < String> (Optional) YAHOO.widget.DataTable.CLASS_ASC or YAHOO.widget.DataTable.CLASS_DESC
给定列实例和排序方式排序给定列

 

 

 

转载于:https://www.cnblogs.com/wishyouhappy/p/3736224.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值