How to Create MultiCombo at client side?

  1. #1

    How to Create a MultiCombo at client side with js code?

    Hi everyone, I want to create multiCombo with javascript code dynamically.
    var setEditor = function (e) {
        var grdEditor;
        if(e.record.data.f1='dt1')
            grdEditor=new Ext.grid.GridEditor(new Ext.form.TextField());
        else if(e.record.data.f1='dt2')
            grdEditor=new Ext.grid.GridEditor(new Ext.form.MultiCombo()); // Ext.form.MultiCombo() undefined
        e.grid.getColumnModel().setEditor(e.column, grdEditor);
    }
    There is no problem with aspx code: <ext:MultiCombo>...</ext:MultiCombo>.
    But "new Ext.form.MultiCombo()" has a error :missing object.
    How could I create it with javascript code?

    zhang
    Last edited by zhangsir199; Aug 20, 2010 at 5:57 AM. Reason: more clear
  2. #2
    Hi,

    You have to register MultiCombo resources (js file) on the server side
    if(!X.IsAjaxRequest)
    {
           ResourceManager.RegisterControlResources<MultiCombo>();
    }
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Quote Originally Posted by vladimir View Post
    Hi,

    You have to register MultiCombo resources (js file) on the server side
    if(!X.IsAjaxRequest)
    {
           ResourceManager.RegisterControlResources<MultiCombo>();
    }
    Thanks, after registered at server side, How could I write javascript code to create multiCombo. I tried this "new Ext.form.MultiCombo();" which still not works:(
  4. #4
    Hi,

    new Ext.net.MultiCombo({
            id: "Multi1",
            renderTo: "Multi1_Container",
            width: 260,
            displayField: "text",
            mode: "local",
            triggerAction: "all",
            valueField: "value",
            store: new Ext.data.SimpleStore({
                fields: ["text", "value"],
                data: [
                    ["Item 1", "1"],
                    ["Item 2", "2"],
                    ["Item 3", "3"],
                    ["Item 4", "4"],
                    ["Item 5", "5"]
                ]
            }),
            selectionPredefined: [{
                value: "2"
            },
            {
                index: 4
            }]
        });
    Vladimir Shcheglov
    Sr. Developer
  5. #5
    Thanks vladimir. It work well:)

Similar Threads

  1. [CLOSED] How I can create a CalendarPanel in client side?
    By supera in forum 2.x Premium Help
    Replies: 2
    Last Post: May 18, 2012, 4:51 PM
  2. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  3. Replies: 4
    Last Post: Mar 19, 2010, 11:35 AM
  4. Create Simple Store and Bind to Grid Client-Side?
    By Tbaseflug in forum 1.x Help
    Replies: 4
    Last Post: Oct 30, 2009, 5:27 PM
  5. Replies: 0
    Last Post: Sep 17, 2009, 8:04 AM

Posting Permissions