[CLOSED] PropertyGrid with combobox editor

  1. #1

    [CLOSED] PropertyGrid with combobox editor

    Hi,

    I'm creating a propertygrid with combobox editor.
    But when I select the item in combobox , and select another cell at the grid, it show the value for the item, not combobox text item
    But when the combobox got focus, the item text appear correctly.

    How to reproduce:

    based on this example:
    https://examples1.ext.net/#/Property...asic/Overview/

    1. Just replace the AddPropertyClick method with this code

      protected void AddPropertyClick(object sender, DirectEventArgs e)
        {
            PropertyGridParameter prop = new PropertyGridParameter()
            {
                Name = "dynProp1",
                DisplayName = "Dynamic Property",
            };
    
            ComboBox cbo = new ComboBox()
            {
                TriggerAction = TriggerAction.All,
                Mode = DataLoadMode.Local,
            };
            cbo.Items.Add(new Ext.Net.ListItem("Value 1", "00000000001"));
            cbo.Items.Add(new Ext.Net.ListItem("Value 2", "00000000002"));
            cbo.Items.Add(new Ext.Net.ListItem("Value 3", "00000000003"));
            cbo.Items.Add(new Ext.Net.ListItem("Value 4", "00000000004"));
            cbo.Items.Add(new Ext.Net.ListItem("Value 5", "00000000005"));
    
            prop.Editor.Add(cbo);
    
            PropertyGrid1.AddProperty(prop);
            PropertyGrid1.DoLayout();
        }
    2. Run the app.
    3. Push "Add property" button;
    4. Select a value on combobx.
    5. Select another cell at the grid.
    6. The combobox will show the value, not item text.
    Last edited by Daniil; Mar 15, 2012 at 7:50 AM. Reason: [CLOSED]
  2. #2
    Hi,

    You should set up a respective Render for that new property.

    Please see the Department column here:
    https://examples1.ext.net/#/GridPane...Field_Mapping/
  3. #3
    Hi Daniil,

    I have tried this:
    prop.Renderer.Handler = string.Format("renderCombo({0},value);", cbo.ID);
    and my javascript code:

    function renderCombo(combo,value)
        {
        
            if(value == '' || value === undefined) return '';
            debugger;
            
            var r = "";
            var store = combo.getStore();
                 
            for(var i=0;i< store.data.items.length;i++)
            {
                var item = store.data.items[i];
                var v = item.data[combo.valueField];
                if(v == value)
                {
                    r = item.data[combo.displayField];
                    break;
                }
            }
         
            return r;
        }
    Now, the value at Propertygrid is empty.

    The variable "r" has value when the return is called.
  4. #4
    Please replace:
    string.Format("renderCombo({0},value);", cbo.ID);
    with
    string.Format("return renderCombo({0},value);", cbo.ID);
  5. #5
    Thanks Daniil,

    Works fine :)

Similar Threads

  1. ComboBox editor
    By Zdenek in forum 1.x Help
    Replies: 3
    Last Post: Dec 03, 2011, 3:38 PM
  2. [CLOSED] Label Editor ComboBox Jumps to left when Editor activated
    By IanPearce in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 19, 2011, 1:31 PM
  3. [CLOSED] PropertyGrid Combobox
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 27, 2011, 6:56 PM
  4. [CLOSED] Combobox in PropertyGrid
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 07, 2011, 4:19 PM
  5. Replies: 2
    Last Post: May 05, 2011, 10:16 AM

Tags for this Thread

Posting Permissions