Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kashif on Jan 13, 2010 05:44
open dhtmlx forum
scheduler.showLightbox

how to change the default double click event of the custom form to on click only.? Pl help
Answer posted by Alex (support) on Jan 13, 2010 06:51

You can try the following:

scheduler.attachEvent("onClick",function(id,e){

  scheduler._on_dbl_click(e);
  return false;
})

Answer posted by kashif on Jan 13, 2010 06:58
nope. Its not working. pl review my code
/////////////////////////////////////
<?=$html->css('nyroModal.full')?>
<?=$html->css('calendar')?>
<?=$html->css('jquery-ui-1.7.1.custom')?>
<?=$html->css('dhtmlxscheduler')?>
<?=$html->css('jquery.ui.autocomplete')?>

<?=$javascript->link('dhtmlxscheduler')?>
<?=$javascript->link('jquery.ui.autocomplete')?>
<?=$javascript->link('dhtmlxscheduler_units')?>
<?=$javascript->link('jquery.livequery')?>
<?=$javascript->link('jquery.nyroModal-1.5.2.pack')?>

<?=$javascript->link('calendar')?>
<?=$javascript->link('daterangepicker.jQuery'); ?>


<script type="text/javascript" charset="utf-8">
    var customRange;
    $(function() {
        $.nyroModalSettings({width: null, height:null,minWidth:460,minHeight:307});

        $('.eventcalendar').livequery(function (){
            $(this).datepicker({
                showOn: 'both',
                <?php /*?>buttonImage: '<?=$this->webroot?>img/icon-calandar.gif',<?php */?>
                buttonImageOnly: true,
                dateFormat: 'mm/dd/yy',
                <?php /*?>buttonText: 'Calendar',<?php */?>
                speed: 'fast',
                showStatus: true,
                mandatory: true,
                beforeShow: customRange
            });
        })
        $('.ui-datepicker-trigger').livequery(function(){
           $(this).hide();
       });
    });
    function init() {

        scheduler.config.xml_date="%Y-%m-%d %H:%i";

        scheduler.config.details_on_create=true;
        scheduler.config.details_on_dblclick=false;


        scheduler.config.lightbox.sections=[
            {name:"title", height:23, map_to:"text", type:"textarea" , focus:true},
            {name:"custom", height:130, type:"textarea", map_to:"details" },
            {name:"time", height:72, type:"time", map_to:"auto"}
        ];

        scheduler.config.first_hour=0;
        scheduler.config.hour_date="%h%a";
        scheduler.locale.labels.section_title="Title";
        scheduler.locale.labels.section_custom="Description";

        scheduler.init('scheduler_here',null,"month");
        scheduler.load("<?=$this->base?>/dhtmlxScheduler/events.php?<? echo "sid=".session_id()?>&uid="+scheduler.uid());

        var dp = new dataProcessor("<?=$this->base?>/dhtmlxScheduler/events.php");
        dp.init(scheduler);
    }
</script>
<table width = '100%'>
<tr><td>
<div>
    <?php //$message->message('Event.Message');  /* this line displays our flash messages */ ?>
    <h1 class="heading">Calendar</h1>
    <div id="delete_msg" style="display:none">></div>
    <div><?php $message->message('Event.Message');?></div>
    <div class="c3 sectionDiv mb10">
        <!-- pnlBox -->
        <div class="pnlBox" style="border:none;">
            <div class="tp"><label>Calendar</label></div>
            <div class="ct">
            <div id="message"></div>
            <div id="scheduler_here" class="dhx_cal_container" style="height:540px;">

                <div class="dhx_cal_navline">
                    <div class="dhx_cal_prev_button">&nbsp;</div>
                    <div class="dhx_cal_next_button">&nbsp;</div>
                    <div class="dhx_cal_today_button"></div>
                    <div class="dhx_cal_date"></div>
                    <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
                    <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
                    <div class="dhx_cal_tab" name="patients_tab" style="right:280px;display:none"></div>
                    <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
                </div>
                <div class="dhx_cal_header">

                </div>
               <div class="clr"></div>
                <br />
                <br />
                <br />
                <br /><br />
                <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                <div class="dhx_cal_data" style="clear:both; border-left:1px solid #c3d9ff; border-bottom:1px solid #c3d9ff;">

                </div>
                    <div class="clr"></div>
            </div>
            </div>
        </div>
    </div>
    <div class="c1 ml10 pl10">
        <div class="sectionDiv mb10">
            <div class="btnLarge" ><a class="calender nyroModal" rev="Model" href="<?=$this->base?>/calendar/add">Add Event</a></div>        </div>
        <div class="sectionDiv mb10">
            <!-- pnlBox -->
            <div class="pnlBox">
                <div class="tp"><label>Upcoming Events</label></div>
                <div class="ct">
                    <h3 class="light">This Week</h3>
                    <div><span></span><?=$todayEvents?> events this week</div>
                    <div class="bdrdoted mt10 mb10"></div>
                    <?php foreach($todayEventsD as $key=>$index){?>
                        <div class="mb5"><span class="light"><b><?=$key+1?></b></span><span>- <?=date('m/d/Y g:i a' , strtotime($index['Event']['start_date']))?> <br> <b><?=$index['Event']['event_name']?></b></span></div>
                    <?php }?>
                </div>
            </div>
        </div>
    </div>
    <div class="clr"></div>
</div>
</td></tr>
<a  id="eventPopup" style="display:none" class="nyroModal" rev="Model"></a>
</table>
<script>
    init();
    //caling popup
    function RTrim( value ) {
        var re = /((\s*\S+)*)\s*/;
        return value.replace(re, "$1");
    }
    scheduler.attachEvent("onClick",function(id,e){
      scheduler._on_dbl_click(e);
      return false;
    })

    scheduler.showLightbox = function(id){
        var startdate = scheduler.getEvent(id).start_date;
        var enddate = scheduler.getEvent(id).end_date;
        var edate=startdate+"";
        var startDateYear=enddate.getFullYear();
        var startDateMonth=edate.substring(4,7);
        var startDateDay=edate.substring(8,10);
        startDateDay=RTrim(startDateDay);
        startTime=edate.substring(16,24);
        startDateFinal=startDateMonth+'-'+startDateDay+'-'+startDateYear;

        var edate=enddate+"";
        var endDateYear=enddate.getFullYear();
        var endDateMonth=edate.substring(4,7);
        var endDateDay=edate.substring(8,10);
        endDateDay=RTrim(endDateDay);
        endTime=edate.substring(16,24);
        endDateFinal=endDateMonth+'-'+endDateDay+'-'+endDateYear;

        eventPopup(id,startDateFinal,endDateFinal,startTime,endTime);
    }
    function eventPopup(id,startDateFinal,endDateFinal,startTime,endTime)
    {
        $('#eventPopup').attr('href','<?=$this->base?>/calendar/add/'+id+'/'+startDateFinal+'/'+endDateFinal+'?startTime='+startTime+'&endTime='+endTime);
        $('#eventPopup').trigger('click');
    }

</script>
//////////////////////////////////////
Answer posted by Alex (support) on Jan 13, 2010 07:24

Try to use 

scheduler.config.details_on_dblclick=true;

instead of

  scheduler.config.details_on_dblclick=false;

Answer posted by kashif on Jan 13, 2010 07:31
Yup Alex, its working only on already created events but not newly created events. I really appreciate your quick response.
Answer posted by Alex (support) on Jan 13, 2010 08:25

You can set details_on_create. So details form will appear right  after event is created.

Answer posted by kashif on Jan 13, 2010 08:45
ohh sorry Alex. I am unable to tell the exact thing. onlcik click event is now working while editing events but i have to double click while creating new one. so i wana same onclick while creating events too. thanks for your timely help.
Answer posted by Alex (support) on Jan 13, 2010 09:14

There isn't public method to do that. Try to use the following:

dhtmlxEvent(scheduler._els["dhx_cal_data"][0],"click",function(e){
    if (!scheduler._locate_event(e?e.target:event.srcElement))
    scheduler._on_dbl_click(e);
})


Answer posted by kashif on Jan 13, 2010 09:19
Wow. Its working. Great! Alex. I have never seen such a quick responder in support. Thanks a lot. May God bless you.