• All
  • Free Web Hosting
  • Category 2
gravatar

How to show search items or data in ExtJs

function showSearch(){
    var dataPanel = Ext.getCmp('details-grid');
    Ext.Ajax.on('beforerequest',function(conn,o,result){
        dataPanel.getEl().mask('Loading data...','x-mask-loading');
    })

    Ext.Ajax.on('requestcomplete',function(conn,o,result){
        dataPanel.getEl().unmask(true);
    })

    Ext.Ajax.on('requestexception',function(conn,o,result){
        dataPanel.getEl().unmask(true);
    })
    Ext.Ajax.request({
        url     : 'ajax/items.php',
        method  : 'POST',
        params  : {
        _method : "showitemlist",
        _class  : "itemlist",
        emp        :Ext.getCmp('itemCode').getValue().toUpperCase()
        },
        callback : function(options,success,result){
            var response = Ext.util.JSON.decode(result.responseText);

            if(response.success){

                store = new Ext.data.Store({
                      proxy  : new Ext.ux.data.PagingMemoryProxy(response.data),
                      reader : new Ext.data.ArrayReader({
                      fields : [
//From your Database Table
                         {name:'ITEMCODE'},
                         {name:'ITEMNAME'},
                         {name:'ITEMPRICE'},
                         {name:'ITEMDESC'},
                         {name:'ITEMREMARKS'},
                         {name:'QUANTITY'},
                         {name:'ISAVAILABLE'},
                         {name:'PURDATE'}
                      ]
                    })
                })
                store.loadData(response.data);
                store.load({params:{start:0, limit:14}});
            }else{
                Ext.MessageBox.show({
                    title   : 'e-Purchase',
                    msg     : response.errors.reason,
                    buttons : Ext.MessageBox.OK,
                    icon    : Ext.MessageBox.WARNING,
                    animEl  : document.body
                })
            }
        }
    })
}