Forum
11:23
24/02/2010
Files used:
1. JQuery 1.3.2
2. JqGrid 3.5.3
3. JQuery UI 1.7.2(core.js, draggable.js, resizable.js, dialog.js)
When a JqGrid is placed inside a dialog window, if "add"/"delete" buttons are enabled
(e.g. { edit: false, add: true, del: true, refresh: false, search: false })
the navgrid seems to duplicated the "add"/"delete" buttons. "Add" button will be rendered twice, same with"Delete" button
$("#divModal").dialog({
autoOpen: false,
modal: true,
title: "abc"
});
divModal is the div contains the table and pager for the JqGrid.
However, when I comment out the dialog function to have divModal as a regular div on the page instead of inside a dialog window, the navgrid render the button correctly. Any thoughts/reply will be greatly appreciated! Thanks in advance.
20:03
Moderators
30/10/2007
Hello,
This is really strange - can you please share your code or provide a link to the problem.
Please all the code if you do so.
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.
08:16
24/02/2010
Hi Tony,
I think I know where the problem is, but I don't know "why" it happens
Following are the code to my program
<script src="<%= Url.Content("~/Scripts/jqueryUI/development-bundle/ui/ui.core.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jqueryUI/development-bundle/ui/ui.draggable.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jqueryUI/development-bundle/ui/ui.resizable.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jqueryUI/development-bundle/ui/ui.dialog.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jqGrid/js/i18n/grid.locale-en.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jqGrid/js/jquery.jqGrid.min.js") %>" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#divModal").dialog({
autoOpen: false,
overflow: true,
title: "testing modal"
});
$("#btnPopUp").click(function() {
$("#divModal").dialog('open');
});
});
</script>
<table id="list" cellpadding="0" cellspacing="0"></table>
<div id="pager"></div>
<input type="button" id="btnPopUp" value="PopUp" />
<div id="divModal">
<script type="text/javascript">
$(function() {
$("#list2").jqGrid({
url: '/Home/Test3Data/',
datatype: 'json',
mtype: 'GET',
colNames: ['Name'],
colModel: [
{ name: 'Name', index: 'Name', width: 680, align: 'left'}],
pager: '#pager2',
rowNum: 5,
rowList: [5, 10, 20, 50],
sortname: 'Name',
sortorder: "desc",
viewrecords: true,
imgpath: '<%= Url.Content("~/Scripts/jqueryUI/css/ui-lightness/images") %>',
caption: 'My first grid'
});
$("#list2").navGrid('#pager2', { add: true, del: true, edit: false, refresh: false, search: false, view: false }, {}, {}, {}, {}, {});
});
</script>
<table id="list2" cellpadding="0" cellspacing="0"></table>
<div id="pager2"></div>
</div>
The code above will generate the error I post before. If you move the javascript "inside" the divModal out of it(outside the divModal), there will not be any problem. You may ask why I didn't put all the javascript in one place, the reason is that divModal is actually a user control I created and use repeatedlly on some other pages. I am happy to pin point down the problem, but I guess this is not a bug.
21:49
Moderators
30/10/2007
Hello,
Thanks for sharing the code.
IMHO, this is not a jqGrid bug, but rather a dialog one. Insetead I will try to investigate the problem
Thanks again
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.
18:30
Moderators
30/10/2007
Hello,
Looking into the code, you will need to call navGrid only once.
The grid itself can determine if it is already constructed and gracefully exit from this situation, but not the navGrid, since every clicking of the button call it again and again.
One possible solution is to define variable if it is called and do not call it if it is already constructed
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.
Most Users Ever Online: 715
Currently Online:
32 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