jqGrid - datepicker fail on multiple grids when same column name is used is each grid

情到浓时终转凉″ 提交于 2019-12-12 06:08:04

问题


When having multiple grids on the same page, where each of the grids is having the same name for the date column (eg 'start_date'), the datepicker choose only the first one.

I know this is the nature of DOM elements, and I was wondering if there is a way to overcome this without changing the colModel.name, as this will also force me to parse the JSON data coming from the server (I don't have any control of the data returned from the server).


回答1:


If I correctly understand your problem then the most easy way to fix the problem would be to use different column names in multiple grids. If you load the data from the server you can use jsonmap property in colModel. For example

{ name: "grid1_column1", jsonmap: "propName", ... }

and

{ name: "grid2_column1", jsonmap: "propName", ... }

As the result you will have no conflicts in any searching of editing fields. The exact format of jsonmap can depend on the format of input data (the format of the server response) which you use.

I would recommend you to use additionally idPrefix with different values in multiple grids. For example idPrefix: "grid1_ and idPrefix: "grid2_. It will prevent conflicts in case of usage native id values for rows of both grids.



来源:https://stackoverflow.com/questions/29041985/jqgrid-datepicker-fail-on-multiple-grids-when-same-column-name-is-used-is-each

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!