1. #1
    Ext User
    Join Date
    Sep 2008
    Posts
    4
    Vote Rating
    0
    ryantracy22 is on a distinguished road

      0  

    Default Reloading of Grid after onSelect of combobox

    Reloading of Grid after onSelect of combobox


    Hi All,

    First of all, I'm a newbie to ExtJS so take it easy on me. I'm sure there's better ways to do this and I'm open to constructive criticism, as this is my first run at this. I have included below my .js for a form that makes a call to a js function that returns a grid...I'm trying to add that grid to a panel element that I added to the page with an id and name of 'testpanel'....I have tried all sorts of things, but at the point I try to do a panel.refresh() i get a object or property not supported error...I'm sure I"m missing something easy but any help would be greatly appreciated as I'm 2 days on this now...thanks in advance....Code below...

    fyi, the function getComplaints() is working and returning the proper information in the grid. (I bolded and underlined the section of the code that I am trying to do this in)




    function getForm(record,page)
    {
    Ext.QuickTips.init();

    if (page == "search")
    {
    var ds = new Ext.data.Store({
    proxy:
    new Ext.data.HttpProxy({
    url:
    'http://localhost:50383/Portal/searchdata.aspx'
    }),
    reader:
    new Ext.data.JsonReader({
    root:
    'data',
    totalProperty:
    'total',
    id:
    'id'
    }, [
    {name:
    'companyname', mapping: 'company'},
    {name:
    'companycity', mapping: 'city'},
    {name:
    'deadbeatid', mapping: 'id'}

    ])
    });
    // Custom rendering Template
    var resultTpl = new Ext.XTemplate(
    '<tpl for="."><div class="search-item">',
    '<h3><span>{companyname}</span></h3>',
    '</div></tpl>'
    );


    var search = new Ext.form.ComboBox({
    store: ds,
    displayField:
    'title',
    typeAhead:
    false,
    loadingText:
    'Searching...',
    width: 570,
    pageSize:10,
    hideTrigger:
    true,
    tpl: resultTpl,
    itemSelector:
    'div.search-item',
    onSelect:
    function(record){ // override default onSelect to do redirect

    var grid = getComplaints(record.data.deadbeatid);
    panel = Ext.getCmp('testpanel');
    panel.add(grid);
    //panel.refresh();
    alert('here: ' + panel.name);
    }
    });

    var searchtitle = new Ext.Panel({
    html:
    '<h3>Deadbeat Search Requires a Minimum of 4 Characters</h3>(Type company name in box above. If company appears, select company to view complaints.',
    width:800,
    bodyStyle:
    'padding:10px 0 0 0; margin:0px 0px 10px 0px;',
    border:
    false
    });

    var testpanel = new Ext.Panel({
    height: 500,
    border:
    false,
    id:
    'testpanel',
    name:
    'testpanel'
    });


    //////GRID///////
    //var grid = getComplaints(0);
    //testpanel.add(grid);
    /////////////////
    //***********************************
    //this is the containing panel.....
    //***********************************
    var mainpanel = new Ext.Panel({
    items:
    [
    search,
    searchtitle,
    testpanel
    ],
    width:795,
    title:
    'Search Deadbeats Database',
    bodyStyle:
    'padding:20px 0 10px 10px; margin:0px 0px 20px 0px;',
    border:
    true
    });

    return mainpanel;

    }
    }
    Ryan Tracy
    ExtJS Newbie

  2. #2
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    671
    Vote Rating
    20
    carol.ext will become famous soon enough carol.ext will become famous soon enough

      0  

    Default


    Welcome.

    1. Learn how to post your code in code tags so it is nicely indented and easier to read. See http://extjs.com/learn/Ext_Forum_Help#Code_Tags . Use the preview button to make sure it looks ok before posting.

    2. I don't see a refresh method in the Panel API, did you try doLayout()?

    3. I don't think you need to override onSelect as done in one of the examples. You are probably needing a 'select' listener. You can research that and ask if you need help.

    I hope that helps

  3. #3
    Ext User
    Join Date
    Sep 2008
    Posts
    4
    Vote Rating
    0
    ryantracy22 is on a distinguished road

      0  

    Default


    Thank you Carol...I will try that, and I'll look into the tags as well. BTW, I'm in Denver, used to live in Littleton, for what it's worth... :-)
    Ryan Tracy
    ExtJS Newbie

Thread Participants: 1