Jquery Dialog Shows Data From Previous Ajax Request
Solution 1:
It's difficult to find the reason of the described problem without looking into the code and without debugging of the problem. So I try just guess.
First of all I strictly recommend you to use always recreateForm: true
option of form editing. Without usage of the option jqGrid hide Edit dialog on closing and show it back on the next editing. jqGrid refills the fields of the form, but in case of usage of recreateForm: true
jqGrid recreate the full editing dialog every time.
The next possible problem could be id duplicates on the page. jqGrid set id
attribute on every jqGrid row and on every column of editing form. If you have more as one grid on the page it's possible that you use native ids from the database. The problem is that native id from the database table are unique only inside of one table. If you display information from different tables ids can be the same. One more example is displaying a grid with based information ad the second grid with details information. In the case the same id could be used twice too. So I recommend you to use idPrefix
option in every grid. For example if you use idPrefix: "a"
in one grid and idPrefix: "b"
in another grid then the id 1
returned from the server will be assigned as rowid "a1"
in the first grid and as rowid "b1"
in the second grid. If the results of row editing will be send back to the server the id prefix will be cut and the server will see the original id=1
.
One more possible origin of id duplicates are in the fields of editing form. The id of the field of the editing form uses id the same as the column name. So if you have more as one grids on the page with the same name
property in both grids you could have id duplicates. So the recommendation: use unique name
attributes for all grids. If you use repeatitems: false
(named fields in the input data) then you can use jsonmap
property of jqGrid which corresponds to the fields of JSON input data and use any free name
value of columns in the grid. In the way you can easy construct grids having unique name
in colModel
. I hope that you understand the construct which I suggest.
I recommend you first of all to try to use recreateForm: true
option adding the line
$.extend($.jgrid.edit, {recreateForm: true});
at the beginning of your code. It will set default value for recreateForm
to true
. After that you should repeat your tests.
It setting of recreateForm: true
will not fix the problem you can include idPrefix
with unique value ("a"
, "b"
, "c"
, ... or "g1_"
, "g2_"
, "g3_"
, ...). After that you should repeat your tests. Making unique name
in colModel
you can make at the last step only if previous steps failed.
Post a Comment for "Jquery Dialog Shows Data From Previous Ajax Request"