Calendar setPosition() for input element bug?

I have been trying to get the calendar setPosition() function to work with input fields. I have read a few posts on these forums and not sure if it is suppose to work for inputs or not.

I looked at the library code and it seems to me it is just a simple bug.
dhtmlxCalendarObject.prototype.setPosition() does not set this.userPosition to true;

this.userPosition is always false.

So when the show() function is called to display the calendar, the logic:
if (this.activeCon.nodeName == ‘INPUT’ && !this.userPosition) {
evaluates to true and over writes the top and left positions set on the parent by the setPosition() function.

I added the code:
this.userPosition = true; in the setPostion() function, and the code works fine for me now.

Am I missing something or is this a bug?

If you initialized calendar for input, there is not posibility to use setPosition method. You may use another approach for iniitialization. Here is the sample:


I appreciate your quick reply, but did you read my post?

I outlined the issue and presented the code fix for the library. I was hoping for a response from a developer to confirm or explain why this.userPosition is not set in the setPosition function where it apparently should be. Not the same replay that I see in all the other posts.

I did read your post. Initialization on input was not designed to customize calendar position, the position is fixed in this case.

However, the solution that you use is incorrect. userPosition will always be true as private calendar methods also call it. All you need is to set userPosition in calendar initialization code:

yourCalendar.userPosition = true;