在jqGrid中重置RowID,如何防止? [英] RowIDs resetting in jqGrid,How to prevent it?

查看:120
本文介绍了在jqGrid中重置RowID,如何防止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,一旦我从分页上执行任何操作(增加行数,移至下一页等),rowID将被重置

For some reason the rowIDs get reset once i do any any action from the pagination(increase the number of rows,move to next page etc)

例如,我总共有75条记录.我一次一次显示15条记录.我总共有3页,每页可以显示15条记录.当我在第一页中显示的记录是1-15时,我得到的行ID为1-15现在,当我移至显示记录16-30的下一页时,我获得了rowID的rowID 1-15.这里,当我移至显示16-30记录的新页面时,我期望rowID从16开始-30但不是,它们是1-15.当我执行从分页器到一次显示30条记录而不是15条记录(默认)时,发生了同样的事情.

for e.g i have 75records in total.Im displaying 15records at a time.In total i have 3 pages each can display 15records.When im in first page which is displaying that records from 1-15 i get rowIDs 1-15 for rows.Now when i move to next page which displays records from 16-30 i get the rowIDs 1-15 for rows.Here when i moved to new page where 16-30 records are being displayed i was expecting the rowIDs to be from 16-30 but they are not,they are from 1-15.Same thing happens when i do an action from pager to display 30 records at a time instead of 15(default).

我希望rowID从1到n条记录开始,而不是每页1-15条记录,有办法吗?如果可以,请帮帮我.谢谢

I want rowID starting from 1 to n number of records instead of 1-15 for each page.Is there a way to do it? If yes than please help me out.thanks

推荐答案

行ID将以这种方式工作,因为当在网格中填充数据时,行ID将为您的行生成动态ID.这是默认行为.

Row Id will work this way because it generates dynamic Ids for your rows when your data is populated in the grid. This is the default behavior.

如果设置主键,则可以获得唯一的行ID.这样,您将获得主键的值作为行ID.只需在colModel集合中设置要设置为主键的列的key: true属性.

You can get a unique row Id if you set a Primary key. this way, you'll get the value of Primary key as row Id. Simply set key: true property of the column you want to set as primary key, in the colModel collection.

这篇关于在jqGrid中重置RowID,如何防止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆