PDA

View Full Version : Adding a custom button to ItemSelector



JackJohnsonX
14 Dec 2015, 7:51 AM
I would like to add a "Remove All" button to an ItemSelector. Here (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.ux.form.ItemSelector-cfg-buttons) is a list of the default buttons according to the docs.

['top', 'up', 'add', 'remove', 'down', 'bottom']


Here is my buttons array:

buttons:["up","add","remove","down", "removeall"]

So two questions, how can I add a background image to the custom button? How about a handler?

The doc states these names ("up","add","remove" etc) "are used to build the button CSS class names"... so I created a class called "removeall" in my CSS file and gave it a background image but that class does not seem to be getting applied to removeall button.

thanks.

JackJohnsonX
14 Dec 2015, 11:57 PM
guess ill just have to update the source code then

jdkhamba
16 Dec 2015, 5:01 AM
Do you absolutely have to use an itemSelector? Based on your business requirement, there might be an easier way to achieve whatever you are trying to achieve then messing around with the source code . Changing the source code of ExtJS is best left to Sencha as it is a slippery slope unless you know exactly what you are doing.