日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Extjs之RowNumberer

發(fā)布時(shí)間:2023/12/10 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Extjs之RowNumberer 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Ext.grid.RowNumberer,Ext.grid.PageRowNumberer

在一個(gè)數(shù)據(jù)表格中,一般都會(huì)加一個(gè)行號(hào),在ExtJs中,要實(shí)現(xiàn)行號(hào)這一效果,只需要一句代碼:

new Ext.grid.RowNumberer()

舉個(gè)例子,代碼如下:

var colModel = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),{ header: "擦寫(xiě)機(jī)器號(hào)", width: 100, dataIndex: 'JSON_no_machine' },{ header: "寫(xiě)入服務(wù)器時(shí)間", width: 150, dataIndex: 'JSON_time_insert' },{ header: "現(xiàn)居住地址", width: 250, dataIndex: 'JSON_xjzdz' },{ header: "服務(wù)處所", width: 100, dataIndex: 'JSON_fwcs' },{ header: "擦寫(xiě)日期", width: 150, dataIndex: 'JSON_cxrq' },{ header: "擦寫(xiě)單位", width: 150, dataIndex: 'JSON_cxdwmc' },{ header: "姓名", width: 50, dataIndex: 'JSON_xm' },{ header: "身份證號(hào)碼", width: 150, dataIndex: 'JSON_sfzhm' },{ header: "擦寫(xiě)時(shí)間", width: 150, dataIndex: 'JSON_make_time' },]);

但有些時(shí)候,我們需要的效果是實(shí)際的行號(hào),是翻頁(yè)之后,行號(hào)不會(huì)重置為1,而是從在上一頁(yè)的最后一條記錄的行號(hào)的基礎(chǔ)上繼續(xù)遞增.這個(gè)時(shí)候,我們需要對(duì)Ext.grid.RowNumberer

進(jìn)行一下擴(kuò)展:

Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, { width : 40, renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){ if(store.lastOptions.params!=null){ var pageindex=store.lastOptions.params.start; return pageindex + rowIndex + 1; } else { return rowIndex + 1; } } });

rowIndex是本頁(yè)表格的行號(hào),從0開(kāi)始,pageindex取至每頁(yè)的Start參數(shù),也是從0開(kāi)始,那么根據(jù)"從在上一頁(yè)的最后一條記錄的行號(hào)的基礎(chǔ)上繼續(xù)遞增",當(dāng)前記錄的行號(hào)就為:

pageindex + rowIndex + 1;

舉個(gè)例子,代碼如下:
//實(shí)際行號(hào)Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, {width: 40,renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {if (store.lastOptions.params != null) {var pageindex = store.lastOptions.params.start;return pageindex + rowIndex + 1;} else {return rowIndex + 1;}}});var colModel = new Ext.grid.ColumnModel([// new Ext.grid.RowNumberer(),new Ext.grid.PageRowNumberer(),{ header: "擦寫(xiě)機(jī)器號(hào)", width: 100, dataIndex: 'JSON_no_machine' },{ header: "寫(xiě)入服務(wù)器時(shí)間", width: 150, dataIndex: 'JSON_time_insert' },{ header: "現(xiàn)居住地址", width: 250, dataIndex: 'JSON_xjzdz' },{ header: "服務(wù)處所", width: 100, dataIndex: 'JSON_fwcs' },{ header: "擦寫(xiě)日期", width: 150, dataIndex: 'JSON_cxrq' },{ header: "擦寫(xiě)單位", width: 150, dataIndex: 'JSON_cxdwmc' },{ header: "姓名", width: 50, dataIndex: 'JSON_xm' },{ header: "身份證號(hào)碼", width: 150, dataIndex: 'JSON_sfzhm' },{ header: "擦寫(xiě)時(shí)間", width: 150, dataIndex: 'JSON_make_time' },]);

?

?

?

NED

?

轉(zhuǎn)載于:https://www.cnblogs.com/Francis-YZR/p/4896021.html

總結(jié)

以上是生活随笔為你收集整理的Extjs之RowNumberer的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。