balbarak / bootstrap-hijri-datepicker

Bootstrap Hijri Date picker
MIT License
56 stars 53 forks source link

Hide and Show hijriDatePicker() and show text based on condition #10

Open prakashjain opened 4 years ago

prakashjain commented 4 years ago

Hello,

Normal datepicker support below code to hide datepicker. $('#datepicker').datepicker("disable")

bootstrap-hijri-datetimepicker.js" lib picker.destroy function available: picker.destroy = function () { /// Destroys the widget and removes all attached event listeners hide(); detachDatePickerElementEvents(); element.removeData('DateTimePicker'); element.removeData('date'); };

$('#datepicker').datepicker("disable") o hide how to implement in hijriDatePicker() in custom js ? $(function () { $("#hijri-date-input").hijriDatePicker(); });

$("#hijri-date-input").on('dp.hide', function (event) {
  // would like to hide hijriDatePicker()
 // if  locale: "ar-sa" (selection other than ar-sa) only show text field try many methods but //working
      });
    });
balbarak commented 4 years ago

Hello,

can you clearfiy what you are going to achieve ?

the picker data name is HijriDatePicker and you could use

$(element).removeData('HijriDatePicker');

if you want to destroy the datetime picker use the following

$("#hijri-date-input").data('HijriDatePicker').destroy();

Hope I get what you want to achieve

Thanks

prakashjain commented 4 years ago

Yes, same thing want to achieve. but the above code not working. Please see the below sample code. <!DOCTYPE html>

Bootstrap Hijri Date Picker

Checkout form

Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.

balbarak commented 4 years ago

try to call this code alone and see if the datepicker get destoyed or not

$("#hijri-date-input").data('HijriDatePicker').destroy()

Thanks

prakashjain commented 4 years ago

Sorry for the late reply. $("#hijri-date-input").data('HijriDatePicker').destroy() Yes the above code working to destroy, but after destroy using below code to display Hijr Date picker initHijrDatePicker(); But now showing. I would like to show/hide Hijr date picker based on selection on change called initHijrDatePicker(); method but not showing calendar view.

balbarak commented 4 years ago

Soon, we will improve the docs and list all features.

Hope you will find what are you looking for

Thanks