Hi I'm using jqGrid and I'm wondering, how do I add jQueryUI's datepicker to some of the input fields when in the add row dialog?
Also how do I check if the input entered are valid?
Thanks in advance!
Hi I'm using jqGrid and I'm wondering, how do I add jQueryUI's datepicker to some of the input fields when in the add row dialog?
Also how do I check if the input entered are valid?
Thanks in advance!
You need to add this lines to the
updateDialog
or to theaddDialog
:Hope this helps.
To get the datepicker in the create/edit popup , you need to add this lines to the updateDialog or to the addDialog:
If you want to format it, you can set format option in datepicker()..like:
After researching this myself a while back, this is what I mashed together based off various input from others. I'm making the assumption that you already have the CSS and JS datepicker files. If not, let me know and I'll track them down for you. Within the
<head>
tags, place the following after your<link rel="stylesheet"... href="css/ui.jqgrid.css" />
line:Then, still within the
<head>
tags mind you, insert the the following after your<script src="js/jquery-ui-1.7.2.custom.min.js" ...></script>
Now, within the colmodel array, you are going to add your datepicker JS code to the field of which the datepicker will be used. In my case, I had a 'Last Modified Date' field. So within the colmodel array, your code should look something like this:
Also, I'm sure you have already checked this out but be sure to visit the jqGrid wiki. The wiki has documentation for the tool and the blog also has forums where questions are asked daily. In fact, I think Tony, the author of the plugin, even has a UI datepicker example on his example page.
Hopefully that helps.
I modified some code snippets that I found. I wanted to use using JSON with local data, along with putting the datepicker as part of my add row button and this worked.