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

Simple TIP: CheckComboBox Plugin

Recommended Posts

Hi,

 

I show a simple use of a CheckComboBox Plugin...

  • Add "CheckComboBox_Plugin.js" to UniServerModule->CustomFiles (adjust the path to the .JS file to yours)
  • Add the following to UniServerModule->CustomCSS (adjust the path to the .GIF file to yours):
    .ux-boundlist-item-checkbox
    {
        background-repeat: no-repeat;
        background-color: transparent;
        width: 13px;
        height: 13px;
        display: inline-block;
        line-height: 13px;
        background-image: url('checkbox.gif');
        background-position: 0 0;
    }
    .x-boundlist-selected .ux-boundlist-item-checkbox
    {
        background-position: 0 -13px;
    }
    
  • Add UniComboBox->ExtEvents->Ext.form.field.ComboBox -> change

    function change(sender, newValue, oldValue, eOpts)
    {
        for (var i=0; i<newValue.length; i++)
        {
           var found=false;
           
           for (var j=0; j<oldValue.length; j++)
             if (newValue[i]==oldValue[j])   { found=true; break;}
           
           if (!found)  ajaxRequest(sender, "checkevent", [ "text="+newValue[i] ]);
        }
    
        for (var i=0; i<oldValue.length; i++)
        {
           var found=false;
           
           for (var j=0; j<newValue.length; j++)
             if (oldValue[i]==newValue[j])   { found=true; break;}
           
           if (!found)  ajaxRequest(sender, "uncheckevent", [ "text="+oldValue[i] ]);
        }
    }
    
  • Add to UniComboBox->UniEvents -> Ext.form.Field.ComboBox -> beforeInit:

    function beforeInit(sender, config)
    {
       Ext.apply(sender, {
          emptyText: 'empty text',
          multiSelect: true,
          plugins: Ext.create('Ext.ux.form.plugin.CheckComboBox')
       });
    }
  • Look at Main.pas to see sample ways to do things...
     

I hope you find it useful to adapt it to your needs...

 

Regards,

 

 

 

20150928_CheckComboBox_Plugin.rar

  • Upvote 6

Share this post


Link to post
Share on other sites

How to programmatically mark multiple positions?

The issue is canceled, I found the answer in the example

Share this post


Link to post
Share on other sites

Hi.

 

Is this still not possible with standard components?

 

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×