Page 1 of 1

select element (multiple) how to stop bootstrap rebuilding ?

Posted: Sun Jan 20, 2013 8:48 am
by carsten888
On a admin-page I got a multiple select element, with all the Joomla usergroups.

Image

with bootstrap the hyrarchy is gone.

Image

Is there a way to stop bootstrap from messing up particular elements by setting a classname?

Code: Select all

select multiple="multiple" class="no_bootstrap"
In Joomla 3 all multiselects seem to been taken out of the core, so I did not find an example of this.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Sun Jan 20, 2013 7:02 pm
by stutteringp0et
If you add the class "chzn-done" to your XML field definition, (and the field type supports classes, beware some custom fields don't) then the "chosen" jquery class will skip the field.

This isn't exactly a documented feature, just something I discovered when looking at how "chosen" operates.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Mon Jan 21, 2013 6:44 am
by carsten888
Thank you very much! That works.

I was already thinking of javascript working on the display both the original select and the newly created one. But obviously this makes things much easyer.

Currently nothing for Joomla 3 extensions seems to be documented at all. And nothing about how to make extensions for 2.5 work for 3.0, which must be so demotivating for all those extension developers worldwide.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Mon Jan 21, 2013 7:13 am
by stutteringp0et
There are some things that work, and others that don't. What I'm finding difficult is making extensions that are compatible with both. What looks good in 2.5 looks terrible in 3.0.

I don't understand the overwhelming NEED to get away from MooTools and pick up jQuery! 3.0 has this mix of MooTools and jQuery code that only means that end-users must endure longer downloads to retrieve a page. I previously avoided extensions that required jQuery, and even wrote some to accomplish the same thing using MooTools....... With the bugs that remain open for a year before they're closed with a message "fix it yourself", I'm beginning to wonder if I released 31 free extensions and devoted all of this time to the wrong CMS.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Tue Jan 22, 2013 9:16 am
by carsten888
There are some things that work, and others that don't. What I'm finding difficult is making extensions that are compatible with both. What looks good in 2.5 looks terrible in 3.0.
True. I've been struggling for weeks, but pretty much got it now. All in one. Just with a lot of version checkers.

Code: Select all

$version = new JVersion;
if($version->RELEASE >= '3.0'){

}else{

}
Now I got to do the same for all my other extensions. Will pobably take less time then the first extension. But still altogether precious months which I had rather spent on coding new/better stuff.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Fri May 16, 2014 7:05 am
by carsten888
that code to stop bootstrap messing with the multiselects has stopped working in Joomla 3.3.0.

Code: Select all

class="chzn-done"
any suggestions how to get this working again?

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Fri May 16, 2014 12:31 pm
by stutteringp0et
It sucks, but the chosenjs folks did this on purpose!

The new way is to destroy the chosen instance on elements where it isn't wanted. Terribly inefficient if you ask me

The js:
$('#elementid').chosen('destroy');

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Fri May 16, 2014 2:00 pm
by stutteringp0et
A side note - this issue is caused by a difference in philosophy between the chosenjs (chosenjs is separate of Bootstrap) folks, and those who decided to implement this javascript in Joomla.

The chosenjs philosophy is to activate chosen on selected fields. So losing chzn-done doesn't bother them at all.

Those who implemented it in Joomla decided to activate it on all fields, requiring us extension developers to figure out how to work with it.

I posted the same answer to the github issues list, along with a link to the chosenjs forum thread discussing the change.

Re: select element (multiple) how to stop bootstrap rebuildi

Posted: Tue May 20, 2014 6:56 am
by carsten888
stutteringp0et wrote: The js:
$('#elementid').chosen('destroy');
Thank you very much. I needed to call it in no conflict mode, but that works. :)