Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Florante on Aug 23, 2009 22:32
open dhtmlx forum
dhtmlx calendar pop-up direction

Hi,

I have some cell on a grid that has dhxCalendar as type. I am wondering if I can make the calendar pop up be a little bit smarter like poping to the left if it is on the right most of the window or pop to the top if it is on the bottom of the browser window or pop down if it is on the top edge of the browser window, etc.

What I have observed is the user needs to scroll down for example to see the calendar if the cell they are trying to edit is on the bottom edge of the browser window.It would be more user friendly if the calendar would pop on top of the cell rather than going down where everything is hidden .


Thanks

Florante




Answer posted by Alex (support) on Aug 24, 2009 06:13

Hello, 

dhxCalendar excell doesn't provide built-in functionality to anable this mode. 

But you can change calendar position to the necessary one using setPosition method: calendar.setPosition(Y,X);

The example for the grid:

grid.attachEvent("onEditCell",function(stage,row_id,column_index){
  if(stage==1 && column_index == 1){
  var cell_position = this.getPostion(this.cells(row_id,column_index).cell);
  var old_x = cell_position[0];
  var old_y = cell_position[1];
  /*... your code here to get new position...*/
  this._grid_calendarA.setPosition(new_y,new_x);
  }
  return true
})


Answer posted by Francisco on Dec 18, 2009 14:33

http://www.dhtmlx.com/docs/products/kb/imgs/_button_post_answer.gif">

Does the above code work with dhxCalendar in a treegrid control?  I got an error on this line:

 var cell_position = this.getPostion(this.cells(row_id,column_index).cell);

Answer posted by Alex (support) on Dec 21, 2009 01:38

There was a type in the provided solution - i letter was missed.

Try to call

var cell_position = this.getPosition(this.cells(row_id,column_index).cell); 

instead of var cell_position = this.getPostion(this.cells(row_id,column_index).cell);

Answer posted by Francisco on Dec 21, 2009 07:13
Thank you.  That did the trick.