Forum
10:30
10/08/2009
Hello Tony!
I found very strange bug in the Inline Editing module.
I use Master/Detail grids and want to add inline editing to “master” grid. I reduced my code to the following example which can reproduce my problem:
Html page:
<div>
<table id=”list”></table>
<div id=”pager”></div>
</div>
<div>
<table id=”detail”></table>
<div id=”pagerdetail”></div>
</div>
Js-file:
jQuery(document).ready(function() {
var lastSel;
var grid = jQuery('#list').jqGrid({
caption: 'Testclusters',
datatype: 'local',
height: 'auto',
pager: '#pager',
pgbuttons: false,
pginput: false,
colNames: ['Name', 'Testtiefe'],
colModel: [
{ name: 'Name', index: 'Name', width: 120, sortable: false, editable: true, editoptions: { size: 30} },
{ name: 'TesttiefeName', index: 'TesttiefeName', width: 180, sortable: false, search: false, editable: true, edittype: "select", editoptions: { value: "Alle SW-Produkte:Alle SW-Produkte;Nur geänderte SW-Produkte:Nur geänderte SW-Produkte", size: 25} }
],
ondblClickRow: function(id, ri, ci) {
//var grid = jQuery('#list');
if (id && id !== lastSel) {
//grid.saveRow(lastsel).editRow(id, true);
grid.restoreRow(lastSel);
lastSel = id;
}
grid.editRow(id, true);
return;
},
onSelectRow: function(id) {
if (id && id !== lastSel) {
//grid.saveRow(lastsel).editRow(id, true);
grid.restoreRow(lastSel);
lastSel = id;
}
var rowdata = grid.getRowData(id);
var gd = jQuery('#detail');
gd.setCaption('Businessprofiele des Testclusters \\'' + rowdata.Name + '\\'');
/*gd.setGridParam({ url: urlGetDetail + id,
page: 1, datatype: 'json'
}).trigger('reloadGrid');*/
}
}).navGrid('#pager');
var mydata = [
{id:"1",Name:"Product 1",TesttiefeName:"Alle SW-Produkte"},
{id:"2",Name:"Product 2",TesttiefeName:"Alle SW-Produkte"},
{id:"3",Name:"Product 3",TesttiefeName:"Nur geänderte SW-Produkte"},
{id:"4",Name:"Product 4",TesttiefeName:"Nur geänderte SW-Produkte"}
];
for(var i=0;i<mydata.length;i++)
grid.addRowData(mydata[i].id,mydata[i]);
var gridDetails = jQuery('#detail').jqGrid({
caption: 'Testclustersdetails',
datatype: 'local',
height: 'auto',
colNames: ['Businessprofil', 'Bereitstellungsform', 'RowVersion'],
colModel: [
{ name: 'BusinessprofilName', index: 'Profil', width: 150, editable: true, editoptions: { size: 30} },
{ name: 'BereitstellungsformName', index: 'Bereitstellungsform', width: 150, search: false, editable: true, editoptions: { size: 25} },
{ name: 'RowVersion', index: 'RowVersion', width: 1, hidden: true, editable: true, editrules: { edithidden: false} }
]
});
});
In this example “detail” grid should shows data depend on row selected in the “master” grid. If one selects a row in the “master” grid, the caption in the “detail” grid will be changed. After double click on a row in the “master” grid the row switched in the inline edit mode. Till now everything works OK. All look like following:
Now we click an arrow in the combo box and receive following strange behavior:
In the title (caption) of “detail” grid the part with the name of the row from “master” grid will be changed to an input field!!!???
I tried to find the corresponding place in the code of jqGrid to fix the problem, but without success. One more problem which I could see here is: during the work with the row in inline mode function onSelectRow are called often, which load every time contain of “detail” grid. Is it would be not better to do nothing instead of selection of already selected row in jqGrid?
Best regards
Oleg
11:08
Moderators
30/10/2007
Hello Oleg,
Will check this. Just now I have made some fix for doble calling onselectrow when in inline edit mode. It is available in GitHub.
Could you please check it.Thanks.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
11:51
Moderators
30/10/2007
Hello,
Problem is fixed in GitHub. You can check this. Also your example works as expected in my demo.
Thanks
Tony
Sorry for editing. There is another post in GitHub.
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
17:29
10/08/2009
Thank you very much!
New version works very well: no input boxes and no unneeded requests to server. It's very pleasant to work with you because of so quick reaction and very good results!
Now I can use in my program inline editing together with form editing. The only small problem stays support of JSON and RESTfull services. But, how you wrote me before, you plan to include such support in version 3.6 of jqGrid. In current version I made small modifications of function saveRow of grid.inlinedit.js so that everithing works. I use additional global parameters in $.jgrid.defaults
$.extend($.jgrid.defaults, {..., mcontentType: "application/json", mtypeEdit: "PUT",
onSerializeData: function(data) { return $.toJSON(data); }, ...}
and then use it in saveRow of grid.inlinedit.js:
instead of
$.ajax({url:url,
data: tmp,
type: "POST",
...
it look like
$.ajax({url:url,
data: $t.p.onSerializeData && $.isFunction($t.p.onSerializeData) ? $t.p.onSerializeData(tmp):tmp,
contentType: typeof $t.p.mcontentType === "string"? $t.p.mcontentType: "application/x-www-form-urlencoded",
type: typeof $t.p.mtypeEdit === "string"? $t.p.mtypeEdit:"POST",
...
So support of JSON and RESTfull services in grid.inlinedit.js makes me no real problem. Close changes I made in grid.formedit.js also. It would be cool of cause if one could use full code jqGrid in the future without any changes.
Thanks a lot one more time.
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
91 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66