Forum


02:30

21/02/2012

Hi all,
I guest the JQGrid framework itself having a bug.
When i set the Add Dialog recreateform: false. The insert after keep increasing for every click on Add button.
Can anyone help me how to resolved this kind of issue?
var nameColumnField = $('#tr_TransferDate', form).show();
$('<tr class="FormData2" id="tr_Description"><td class="CaptionTD ui-widget-content" colspan=10><hr style="border:solid #00CCFF; border-width:1px 0 0 0; width:1500; height:0;line-height:0px;font-size:0;margin:0;padding:0;"><legend><b>Asset Details</b></legend></td></tr>').insertAfter(nameColumnField);
var nameColumnField = $('#tr_AID', form).show();
$('<tr class="FormData2" id="tr_EntityID"><td class="CaptionTD ui-widget-content" colspan=10><hr style="border:solid #00CCFF; border-width:1px 0 0 0; width:1500; height:0;line-height:0px;font-size:0;margin:0;padding:0;"><legend><b>General Information</b></legend></td></tr>').insertAfter(nameColumnField);
Please advise.
Thank you.
Regards,
Micheale
09:20

Moderators
30/10/2007

Hello,
I really have dificulties to understand what you mean.
From where you get this code?
This code does not exists in jqGrid.
Regards
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.
14:54

10/08/2009

Hello micnie2020,
I agree with Tony, that it's difficult to understand what you mean. I try to guess. I can suppose that you add some additional elements in the form inside of editing for callback like beforeShowForm. If you don't use recreateform: false then your current code add the same custom element every time when the form will be opened.
It seems to me that you should modify your code a litte and verify whether the custom elements are already in the form. You should add the custom elements only when there are not yet in the form. If you would add some custom class or id to one from the added elements then the corresponding verification will be very simple.
Best regards
Oleg
16:02

21/02/2012

Hi All,
Could you please try to run this script:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml;
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/redmond/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.1/css/ui.jqgrid.css" />
<style type="text/css">
html, body { font-size: 75%; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js%22%3E%3C/script"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js%22%3E%3C/script"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.1/js/jquery.jqGrid.src.js%22%3E%3C/script"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
var mydata = [
{ id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "2", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "3", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
{ id: "4", invdate: "2007-10-04", name: "test4", note: "note4", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "5", invdate: "2007-10-31", name: "test5", note: "note5", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "6", invdate: "2007-09-06", name: "test6", note: "note6", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
{ id: "7", invdate: "2007-10-04", name: "test7", note: "note7", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "8", invdate: "2007-10-03", name: "test8", note: "note8", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "9", invdate: "2007-09-01", name: "test9", note: "note9", amount: "400.00", tax: "30.00", closed: false, ship_via: "TN", total: "430.00" },
{ id: "10", invdate: "2007-09-08", name: "test10", note: "note10", amount: "500.00", tax: "30.00", closed: true, ship_via: "TN", total: "530.00" },
{ id: "11", invdate: "2007-09-08", name: "test11", note: "note11", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" },
{ id: "12", invdate: "2007-09-10", name: "test12", note: "note12", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" }
],
$grid = $("#list"),
numberTemplate = {formatter: 'number', align: 'right', sorttype: 'number', editable: true,
searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'] }},
dateTemplate = {align: 'center', sorttype: 'date', editable: true, editrules: { date: true},
formatter: 'date', formatoptions: { srcformat: 'ISO8601Long', newformat: 'ShortDate' }};
$grid.jqGrid({
datatype: 'local',
data: mydata,
colNames: [/*'Inv No', */'Client', 'Date', 'Amount', 'Tax', 'Total', 'Closed', 'Shipped via', 'Notes'],
colModel: [
//{ name: 'id', index: 'id', width: 70, align: 'center', sorttype: 'int', searchoptions: { sopt: ['eq', 'ne']} },
{ name: 'name', index: 'name', editable: true, width: 65, editrules: { required: true} },
{ name: 'invdate', index: 'invdate', width: 94, template: dateTemplate },
{ name: 'amount', index: 'amount', width: 75, template: numberTemplate },
{ name: 'tax', index: 'tax', width: 52, template: numberTemplate },
{ name: 'total', index: 'total', width: 60, template: numberTemplate },
{ name: 'closed', index: 'closed', width: 70, align: 'center', editable: true, formatter: 'checkbox',
edittype: 'checkbox', editoptions: {value: 'Yes:No', defaultValue: 'Yes'},
stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':Any;true:Yes;false:No' } },
{ name: 'ship_via', index: 'ship_via', width: 105, align: 'center', editable: true, formatter: 'select',
edittype: 'select', editoptions: { value: 'FE:FedEx;TN:TNT;IN:Intim', defaultValue: 'IN' },
stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':Any;FE:FedEx;TN:TNT;IN:IN' } },
{ name: 'note', index: 'note', width: 60, sortable: false, editable: true, edittype: 'textarea', hidden: true }
],
rowNum: 10,
rowList: [5, 10, 20],
pager: '#pager',
gridview: true,
rownumbers: true,
autoencode: true,
ignoreCase: true,
sortname: 'invdate',
viewrecords: true,
sortorder: 'desc',
height: '100%',
caption: 'Test grid which use jQuery events'
});
$grid.jqGrid('gridResize', { minWidth: 450, minHeight: 150 });
$.extend($.jgrid.edit, {
recreateForm: false,
beforeShowForm: function(form) {
$('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
'<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all">' +
'<b>Invice information (all about money):</b></div></td></tr>')
.insertBefore($('#tr_amount', form));
$('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
'<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all">' +
'<b>Delivery information:</b></div></td></tr>')
.insertBefore($('#tr_closed', form));
}
});
$grid.jqGrid('navGrid','#pager', { del: false, search: false });
});
//]]>
</script>
</head>
<body>
<table id="list"></table>
<div id="pager"></div>
</body>
</html>
Please advise.
Thank you.
Regards,
Micheale
16:31

10/08/2009

Hello Micheale,
I see that you use my demo from the answer. I tried to describe the solution in my previous answer. You can see the modified demo here. I used modified version of the beforeShowForm callback:
if ($form.find(".mytitle").length === 0) {
$('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
'<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all mytitle">' +
'<b>Invice information (all about money):</b></div></td></tr>')
.insertBefore('#tr_amount');
$('<tr class="FormData"><td class="CaptionTD ui-widget-content" colspan="2">' +
'<hr/><div style="padding:3px" class="ui-widget-header ui-corner-all mytitle">' +
'<b>Delivery information:</b></div></td></tr>')
.insertBefore('#tr_closed');
}
}
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
44 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