Try our conversational search powered by Generative AI!

Dojo color picker - nice, but once you use, you can never go back

Vote:
 

Am I missing how to deselect a color once one is chosen? 

#145801
Mar 11, 2016 19:19
Vote:
 

You can extent the ColorPicker with a reset button like this:

define([
        "dojo/_base/declare",
        "dijit/ColorPalette",
        "dijit/form/Button"
],
function(declare, ColorPalette, Button) {
    return declare("alloy.editors.ColorPalette", [ColorPalette], {
        templateString: '<div class="dijitInline dijitColorPalette" role="grid"> ' +
            '<table dojoAttachPoint="paletteTableNode" class="dijitPaletteTable" cellSpacing="0" cellPadding="0" role="presentation"> ' +
            '<tbody data-dojo-attach-point="gridNode"></tbody> ' +
            '</table>' +
            '<div data-dojo-attach-point="aButton" data-dojo-props="iconClass:\'dijitEditorIcon dijitEditorIconCut\', showLabel: false"></div>' +
            '</div>',

        widgetsInTemplate: true,

        postCreate: function () {
            var obj = this;
            this.button = new Button({
                label: "Reset",
                onClick: function() {
                    obj.set('value', null);
                }
            }).placeAt(this.aButton);
        }
    });
});

Clicking on the reset button will set the value to null.

Little disclaimer: I'm no dojo expert, so no guarantees here :)

/Mark

#145883
Mar 14, 2016 17:26
Vote:
 

Thank you, Mark. I will give that a try. I'm still a newbie at Epi/MVC/C#

#145884
Mar 14, 2016 17:29
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.