Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Date Picker Problem
09/02/2011
17:10
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

Need Help Please!  I have implemented a date picker on my JQGrid.  The problem is that when the calender pops up and you select a date, and move to another cell, the date disappears.  I had it working, but only when calling a reloadGrid from an onSelect function (EX #1 below).  I've added other code to color code rows, and am having the same problem again. 

EX #1

{name: 'effDT',index:'effDT', sorttype:"date", width:40, editable:true,

editoptions: {size: 10, maxlengh: 10,dataInit:{$(element).datepicker({onSelect: getDt(dateText, inst); }})}}},

function getDt(dateText, inst) {

     jQuery(

"#permitList").trigger("reloadGrid");

}

I found an entry on the forum from Tony that said to call the SetTimeout function to correct this error (EX #2 below), but now the calender doesn't pop up at all.

EX #2

{name:'effDT',index:'effDT', sorttype:"date", width:40, editable:true,function(element)

editoptions: {size: 10, maxlengh: 10,dataInit: setTimeout({$(element).datepicker()},300)}},

 

Please help to get this working.

Jennifer

14/02/2011
15:54
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

Has anyone had this issue?

14/02/2011
19:18
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

It seems to me that you use dataInit function in absolutely wrong way. 

dataInit: function (elem) {
    $(elem).datepicker();
}

or something like

dataInit: function (elem) {
    setTimeout(function(){
        $(elem).datepicker();
    }, 100);
}

Please compare both examples with your code.

Moreover I see no sense to call reload the full grid just if the user select date: you use jQuery("#permitList").trigger("reloadGrid"); which do this.

Best regards
Oleg 

14/02/2011
19:33
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

Thank you.  I changed my datainit to

{name:'effDT',index:'effDT', sorttype:"date", width:40, editable:true,function (elem) {

editoptions: {size: 10, maxlengh: 10,dataInit:

$(elem).datepicker();}}},

It still does not keep the date that's selected from the calendar once you move off of the cell.  Any ideas?

14/02/2011
19:45
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Why you place function (elem) { in the absolutely wrong place before editoptions? It must be after dataInit:.

15/02/2011
19:06
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

It is in the right place, for some reason when I pasted it into the browser, it didn't stay formatted correctly.  This is what I have:

{name:'effDT',index:'effDT', sorttype:"date", width:40, editable:true,editoptions: {size: 10, maxlengh: 10,dataInit:

function (elem) {$(elem).datepicker();}}},

15/02/2011
20:01
Avatar
admin
Admin
Members
Forum Posts: 66
Member Since:
05/05/2007
sp_UserOfflineSmall Offline

Hello,

Please use setTimeout when set datepicker.

Please look the red text here :

http://www.trirand.com/jqgridw.....ditoptions

I'm not sure that all documentation is updated.

Regards

Tony

15/02/2011
20:19
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

I added the SetTimeOut() and now the datepicker calendar won't pop up. 

{name:'effDT',index:'effDT', sorttype:"date", width:40, editable:true,

editoptions: {size: 10, maxlengh: 10,dataInit:function (elem) { setTimeout(function(){

$(elem).datepicker();}, 100); }}},

Any Suggestions?

17/02/2011
16:03
Avatar
Jbrandolino
Member
Members
Forum Posts: 10
Member Since:
07/02/2011
sp_UserOfflineSmall Offline

Was able to get the datepicker to open with this code:

{name:'effDT',index:'effDT', sorttype:"date", width:40, editable:true,

editoptions: {size: 10, maxlengh: 10,dataInit:function(element)

{$(element).datepicker()}}},

I was then getting 'URL not set' error, so I added this code to the grid definition:

editurl:'url',

cellsubmit:'clientArray', 

 

Now have new issue with date not getting set when user doesn't click elsewhere in grid.  See new post.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
10 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information