Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by andreea on Jun 13, 2008 01:56
open dhtmlx forum
not been able to make a cell a calendar type

i have added <link rel="stylesheet" type="text/css" href="<?= BASEURL ?>/fw_headers/js/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.css"/>
<link rel="stylesheet" type="text/css" href="<?= BASEURL ?>/fw_headers/js/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar_skins.css"/>
    
<script type="text/javascript" src="<?= BASEURL ?>/fw_headers/js/dhtmlx/dhtmlxgrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js"></script>
     <script type="text/javascript" src="<?= BASEURL ?>/fw_headers/js/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
            

the configuration for the grid is:
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("<?=BASEURL?>fw_headers/js/dhtmlxgrid/codebase/imgs/");
mygrid.setHeader('<?= LBL_START_DATE ?>,<?= LBL_BUS_ROUTE_FROM ?>,<?=LBL_STOP_FROM?>,<?=LBL_BUS_ROUTE_FROM?>,<?=LBL_STOP_TO?>,<?=LBL_RETOUR?>,<?=LBL_DIRECTION?>');
mygrid.setInitWidths("100,100,100,100,100,100,100");
mygrid.setColAlign("center,center,center,center,center,center,center");
mygrid.setColTypes("dhxCalendarA,co,co,co,co,ch,ch");
mygrid.setColSorting("str,str,str,str,str,str,str");
mygrid.enableMultiselect(true);
mygrid.enableAlterCss("even","uneven");
mygrid.enableAutoHeigth(true);
mygrid.init();
mygrid.setOnEditCellHandler(doOnCellEdit);
mygrid.setSkin("light");
mygrid.loadXML("<?php echo BASEURL; ?>/xml_grids/booking_persons.xml");
mygrid.setSizes();

i have also tried with calendar instead of dhxCalendarA. Yet i get this error aeditor has no properties
_fillRow(tr, [" ", " add route ", " add stop ", 4 more...])dhtmlxgrid.js (line 3624)
_addRow("new1", [" ", " add route ", " add stop ", 4 more...], 0)dhtmlxgrid.js (line 3707)
addRow("new1", [" ", " add route ", " add stop ", 4 more...], 0)dhtmlxgrid.js (line 3551)
addRow("new1", [" ", " add route ", " add stop ", 4 more...], 0, 0, undefined, undefined)dhtmlxtreegrid.js (line 596)
onclick(click clientX=0, clientY=0)managing_persons# (line 1)
[Break on this error] aeditor.setValue(val) , when a try adding a row :
i do this with : <a href="#" onclick=' mygrid.addRow("new"+(mygrid.getRowsNum()+1)," , add route , add stop , add route, add stop , 1 ,0 ",0);'>Add a new row</a>
Answer posted on Jun 13, 2008 09:54
The code which you are using is correct, and must work without problems.
Attached sample uses the same code for initialization, and the same code for row adding and works correctly.

Please be sure that
    dhtmlxgrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js
really exists. There was incorrect build available some time ago, which missed this file ( it it missed - you can use one from attached sample )
Attachments (1)
Answer posted by Tom Ince on Jun 16, 2008 14:24
I cannot get this working either.  Their is absolutely no documentation on getting this working.  The sample you provided does not work for me.
Answer posted by Tom Ince on Jun 16, 2008 14:40

The error is in dhtmlxgrid_excell_calendar.js.  The error is :

Microsoft JScript runtime error: Object expected

and happens with the following code :

_grid_calendar_init()

Answer posted by Support on Jun 17, 2008 04:10
>>I cannot get this working either.
Sample attached to previous reply was tested in all common browser ( IE, FF, Opera, Safari ) - and works correctly.
Which browser you are using?


>>Their is absolutely no documentation on getting this working.
All that need to be done
a) necessary column type set ( dhxCalendar in case of dhtmlxCalendar , or calendar in case of YUI calendar )
b) necessary js files included
    in case of dhxCalendar
       dhtmlxgrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js
       dhtmlxcalendar/codebase/dhtmlxcalendar.js

    in case of calendar
       dhtmlxgrid/codebase/excells/dhtmlxgrid_excell_calendar.js
       set relative path to codebase
       <script>_css_prefix="../../codebase/"; _js_prefix="../../codebase/"; </script>

>>The error is in dhtmlxgrid_excell_calendar.js.  The error is :
Please be sure that you defined correct path to codebase in _js_prefix variable ( it is necessary to load other used YUI files )
Answer posted by Tom Ince on Jun 17, 2008 05:40

I've placed the dhtmlX code in {webroot}/dhtmlx/

That folder has subfolders calendar which contains YAHOO.js and other necessary calendar stuff.  Their is also a subfolder excells, which contains the dhtmlxgrid_excell_calendar.js file.

I set

<script>_css_prefix="../"; _js_prefix="../"; </script>

Now, again, there is no documentation.  I'm assuming the prefix must be for loading from the excells subfolder and that the calendar folder is hardcoded.  Am I wrong?  If I am, where should the _css_prefix and _js_prefix variable point to?

Answer posted by Tom Ince on Jun 17, 2008 05:46

Ok, I've FINALLY figured this out.  The prefix's are used for add the includes via <script> and <link> HTML, so the path to the files from the {webroot} are needed.

Now, another problem, the calendar allows changing month by month, but you cannot change years.  The dhxCalendarA type allows changing years (although it's not intuitive) but has no way to change the months.  Are there other calendar types that allow you to change both the month and the year?

Answer posted by Support on Jun 17, 2008 06:00
>>Now, another problem, the calendar allows changing month by month, but you cannot change years.  The dhxCalendarA type allows changing years (although it's not intuitive) but has no way to change the months.

In case of "calendar" excell we are limited to functionality of YUI calendar - it possible to enable any modes of it, but as far as I can see it doesn't allow a way to change current month, except of previous|next buttons.

The dhxCalendar allows selection month by next|previous button and direct selection of year, basically it possible to enable direct month selection ( in same manner as current year selection implementation )

Updated js file for dhxCalendar excell attached.
Attachments (1)