1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    2
    Vote Rating
    0
    ZeitEbo is on a distinguished road

      0  

    Default JavaScript show Datepicker

    JavaScript show Datepicker


    Hello everyone,
    I'm on ExtJS4 validate.
    I had been using ExtJS 3
    Now I have problems to open the datepicker via javascript.

    <!--My aspx code:-->

    <td align="center"><input type="button" id="dateButton" value="<%= Msg("pro021") %>" name="dateButton" onClick="showDatePicker(Ext.Date.parse(f1.dateCtrl.value, 'd.m.Y'), f1.dateCtrl, 'Ymd', f1);"></td>


    <!-- JavaScript code -->
    function showDatePicker(date, targetCtrl, outFormat, form, alignTo, submitCmd, onSelect) {
    if(dateMenu == null){
    dateMenu = new Ext.menu.DatePicker({
    hideOnClick: true,
    focusOnSelect: false,
    shadow:false
    });
    }
    var picker = dateMenu.picker;


    picker.mobiloTargetCtrl = targetCtrl;
    picker.mobiloTargetFormat = outFormat;
    picker.mobiloFormToSubmit = form;
    picker.mobiloSubmitCmd = submitCmd;
    picker.mobiloOnSelect = onSelect;

    if (date == null) {
    date = new Date();
    }

    picker.setValue(date);
    if (alignTo == null) {
    dateMenu.show('dateButton', "tl-bl?");
    } else {
    dateMenu.show(alignTo, "tl-bl?");
    }
    picker.focus();
    datePickerEvents('on');
    }

    Why the datepicker does not appear? He should appear directly below the button.

    Thank you very much until now
    ZeitEbo

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,459
    Vote Rating
    202
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Perhaps showBy() is what you'll need to show the menu by another component?
    http://docs.sencha.com/extjs/4.2.1/#...-method-showBy
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

  3. #3
    Sencha User
    Join Date
    May 2013
    Posts
    2
    Vote Rating
    0
    ZeitEbo is on a distinguished road

      0  

    Default


    Hi Slemmon,

    Thanks for the answer,

    No, this also works not. Why run my code in ExtJS 3.2 an in ExtJS 4.2 not?

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,459
    Vote Rating
    202
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Demo

    HTML:
    Code:
    <input type="button" id="dateButton" value="value" name="dateButton" onClick="window.showDatePicker();">
    Javascript
    Code:
    window.datePicker = Ext.widget('datepicker', {
        renderTo: document.body,
        hidden: true
    });
    
    
    window.showDatePicker = function () {
        datePicker.showAt(Ext.getBody());
    };
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

Thread Participants: 1