Home Forums Porto Admin Template Can't Search on Modal

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10030020
    riandy
    Participant

    Hello, I can’t do search when using select box in modal. here’s the HTML of the search box.

    https://pastebin.com/wcvtVu3t

    Can you help me to fix this? Or there are a special select’s class in modal? Thank you!



    Template Version: -
    #10030029
    Support2
    Keymaster

    Hello,

    This is a common issue with the Select2 JS: https://select2.org/troubleshooting/common-problems

    To get the input working properly inside a modal please change the code of modal in (js/examples/examples.modals.js) to:

    /*
    Modal with CSS animation
    */
    $('.modal-with-zoom-anim').magnificPopup({
    	type: 'inline',
    
    	fixedContentPos: false,
    	fixedBgPos: true,
    
    	overflowY: 'auto',
    
    	closeBtnInside: true,
    	preloader: false,
    	
    	midClick: true,
    	removalDelay: 300,
    	mainClass: 'my-mfp-zoom-in',
    	modal: true,
    
    	callbacks: {
    		open: function() {
    		    $(function() {
    				$('#fpegawai_id').select2('destroy');
    				$('#fpegawai_id').select2({
    					theme: 'bootstrap',
    					placeholder: 'Pilih Surveyor',
    					allowClear: true,
    					dropdownParent: $('#modalAddSurveyor')
    				});
    			});
    		}
    	}
    });

    * Basically we need to destroy and re-initialize the select 2.

    Hope this helps.

    Let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


    #10030033
    riandy
    Participant

    Thank you, it works!


Viewing 3 posts - 1 through 3 (of 3 total)