All,
I'm trying to implement custom warning message like 'Please Select row' when toolbar button[top pager] is pressed. I don't want to use alert!!
I followed one of the examples from Oleg(JqGrid guru atleast to me!!) i.e.Stackoverflow reference - jqGrid warning dialog. Oleg demo reference - http://www.ok-soft-gmbh.com/jqGrid/Warning.htm
All works well if i use the version same as in Oleg demo. BUT if i change the jqGrid version 4.8.0, the same demo not working :(
I used -
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.8.0/js/jquery.jqgrid.src.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.8.0/css/ui.jqgrid.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.8.0/js/i18n/grid.locale-en.js"></script>
instead of
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.0/js/jquery.jqGrid.src.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.0/css/ui.jqgrid.css" />
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.0/js/i18n/grid.locale-en.js"></script>
Any idea whether modal usage changed in later version ?
Best Regards, Sundar
First of all I would recommend you to use the latest version of free jqGrid. It's 4.9.2. You can download it from GitHub or use from CDN directly (see here). The corresponding URLs will be
and optionally the language file
Including of English locale file
grid.locale-en.js
is not required, because it's included now in the main code of free jqGrid (jquery.jqgrid.min.js
orjquery.jqgrid.src.js
).Before I explain the problems in the old demo I would recommend you to use simplified method
$.jgrid.info_dialog
to create small dialog. The corresponding code could beThe displayed dialog will be like below
If you want use text elements from locale file then the code could be modified to the following
If you want to display exactly the same alert dialog which displays free jqGrid if no row is selected then the code could be especially simple
In the case you can't customize the texts, but the usage is really simple.
If you want to use
createModal
andviewModal
like in old demo you should understand the following. There are of cause many changes in free jqGrid. The main compatibility problem in the code: one should call$.jgrid.createModal
by settingthis
to the DOM of the grid. So one have to modify$.jgrid.createModal(...)
in the old demo to$.jgrid.createModal.call(this,...)
. The next problem in the old demo very simple. The condition$("#"+alertIDs.themodal).html() === null
is wrong in the current versions of jQuery and one should better use$("#"+alertIDs.themodal).length === 0
instead. It's the next main problem in the old demo. The full code could be for example the following