Material Select and Datepicker


Topic: Material Select and Datepicker

Hsunight asked 8 years ago

HI, I have some question about Material Select and Datepicker 1. How can I remove all selected item in Material Select? I had use destory, however the selected item still selected 2. Datepicker when I select a date and close it, than I look other file and come back to the browser, datepicker will popup again, I had try to blur the focus, however it notwork...
Hi, I need some more details about what you're expecting to do with your Material Select. Please, send me your code for Material Select and Datepicker. Regards

Hsunight answered 8 years ago

Here's the code, thanks a lot Material Select : I need when I click initSelect, if it have select some item should go back to Choose your option source code Datepicker : I need when I select some date and close datepicker, zoom browser viewport out and open it datepicker shouldn't show again, it very strange... source code

Hsunight answered 8 years ago

Datepicker have another question, this also need init too... I had use date-value to set default value, however, if I select a date and set again data-value, the select still is the date that first time I select, I need it select new date source code
Try this: Material Select:
$(function(){
  $('.mdb-select').material_select();
  
  $("#initSelect").click(function(){
    console.log("initSelect");
     $('.select-dropdown li:first-child').removeClass('disabled').trigger('click').addClass('disabled');
  });
});
Datepicker:
$(function(){
  $('.datepicker').pickadate({
    format: 'yyyy/mm/dd',
  });
  $('#initDatepicker').click(function(){
    $('.datepicker').val($('.datepicker').attr('data-value'));
  });
});
There's a bug in our datepicker, so that's the reason why you're having a problem with popping-up. We'll fix it as soon as possible.

Hsunight answered 8 years ago

Both not good solution... Why reset material-select it will pop up, it's very illogical, datepicker only clean input value, however when I open datepicker, before date still selected
About Material Select: can you say more precisely what's wrong? Here's the solution for Datepicker:
$(function(){
  $('.datepicker').pickadate({
    format: 'yyyy/mm/dd',
  });
  $('#initDatepicker').click(function(){
   var date = $('.datepicker').attr('data-value');
    var picker = $('.datepicker').pickadate('picker');
    picker.set('select', date);
  });
});

Hsunight answered 8 years ago

Datepicker Solution is better! And about Material Select, it's my wrong! I'm sorry! I forgot my select is multiple select, if use that solution, checkbox will be check and select option won't be uncheck source code

Hsunight answered 8 years ago

I have two new question again, can material-select have group with multiple? I try to mix them, unfortunately, notwork... If material-select can have group, can I check group then all group item checked? source code
The only way to mix it is our solution below: <select class="mdb-select" multiple> <option value="" disabled selected>Group 1</option> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> <option value="" disabled>Group 2</option> <option value="4">Option 4</option> <option value="5">Option 5</option> <option value="6">Option 6</option> </select> <label>Example label</label>

Hsunight answered 8 years ago

Okay...but have multiple and can't use group is very wired, hope can add to MDB's plan

Hsunight answered 8 years ago

Does multiple select have solution?
We don't have any better solution for now, but for sure it will change in the future.

Hsunight answered 8 years ago

I try to use className checked is it selected source code Hope MDB team can make it better
Could you explain what do you want to get?

Hsunight answered 8 years ago

Just multiple-select need a reset function
Currently we don't have any solutions for multiple-select reset, but we'll be working on it in the near future.

herve pro answered 7 years ago

Hello, I have enabled typing into the input but i would like to have the possibility to trigger the pickadate popup, for example when i click on an icon close to the input field. is it possible ? Thank you
Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No