Jump to content
uniGUI Discussion Forums
Sign in to follow this  
ice

Colorpicker in Grid

Recommended Posts

Thanks,

but i can't find change and focus in UniComboBox1 -> ClientEvents -> ExtEvents 

 

UniGui Ver: 1.0.2.1434

Share this post


Link to post
Share on other sites

Hi,

 

Thanks,

but i can't find change and focus in UniComboBox1 -> ClientEvents -> ExtEvents 

 

UniGui Ver: 1.0.2.1434

 

You can try to add these events in function afterCreate:

function afterCreate(sender)
{
    sender.addListener(
        'change',
        function(sender, newValue, oldValue, eOpts) {
            var element = sender;
            var inputEl = element.inputCell.child('input');
            var data = element.getStore().findRecord(element.valueField, newValue);

            if (data) {
                inputEl.applyStyles('padding-left:42px');
                var parent = inputEl.parent(),
                    spanDomEle = parent.child('span');

                if (!spanDomEle) {
                    Ext.DomHelper.insertFirst(parent, {
                        tag: 'span',
                        html: '        '
                    });
                    var newSpanDomEle = parent.child('span');
                    newSpanDomEle.applyStyles('background-color: ' + getHexa(data.get(element.displayField)) + ';float: left; position: absolute; top: 0.9px; margin: 3px 2px 2px 4px; width: 33px; height: 15px;');
                } else {
                    spanDomEle.applyStyles('background-color:' + getHexa(data.get(element.displayField)));
                }
            }
        }
    );

    sender.addListener(
        'focus',
        function(sender, e, eOpts) {
            var parent = sender.inputCell.child('input').parent(),
                spanDomEle = parent.child('span');

            if (spanDomEle) {
                spanDomEle.applyStyles('background-color:' + getHexa(sender.value));
            }
        }
    );
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×