Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    50
    Answers
    1
    Vote Rating
    0
    sathyan_8294 is on a distinguished road

      0  

    Default Unanswered: how to search for entered text in search field

    Unanswered: how to search for entered text in search field


    hai all,
    The following code is used to list all records from database for without any entered in search field.
    i want to list records from sql database for entered text in search field.
    for example,the product name camera in sql database means,if i enter camera in search field means,i want to display camera only.
    like that if entered only b and click search button means want to list records starting with letter b...how to do these allthings....
    so i want to display records for with and without entered text in search field.
    then how to diplay records from sql database in text field...
    Ext.setup({
    onReady:function()
    {
    Ext.regModel('Products',
    {
    fields:['ProductName','Price','ManufacturedCompany','MadeBy']
    });


    var detailsform=new Ext.form.FormPanel({
    style:'padding:25px',


    items:[{xtype:'textfield',id:'ProductName',label:'name'}]
    });


    var detailspanel=new Ext.Panel({
    layout:{
    type:'vbox',
    align:'center'
    },
    dockedItems:[{xtype:'toolbar',
    items:[{
    ui:'back',text:'back',
    handler:function()
    {
    searchpanel.setActiveItem(searchlistpanel);
    }
    }]}],
    items:[detailsform]


    });

    var searchlist=new Ext.List({
    width: 1500,
    height: 500,
    scroll:'vertical',
    onItemDisclosure : false,

    listeners : {
    itemtap : function(that,index,item,e){
    if (e.getTarget('.x-list-disclosure')) {
    //Ext.Msg.alert("Disclosure clicked!");
    } else if(e.getTarget('.x-list-item-body')){
    detailsform.update('ProductName=' + that.getStore().getAt(index).data.ProductName + '<br />' + 'Price=' + that.getStore().getAt(index).data.Price + '<br />' + 'ManufacturedCompany=' + that.getStore().getAt(index).data.ManufacturedCompany + '<br />' + 'MadeBy=' + that.getStore().getAt(index).data.MadeBy);

    searchpanel.setActiveItem(detailspanel);


    }
    }
    },
    itemTpl : '<table width="100%"><tr width="100%"><td width="20%"><img src="winter.jpg" height="10%" width="15%"/></td><td width="70%"><p style="padding-left:10px;" width="70%">ProductName={ProductName}<br>Price={Price}</p></td></tr></table>',


    indexBar: true,

    store: new Ext.data.Store({
    model: 'Products',
    autoLoad: true,
    proxy: {
    type: 'ajax',
    url: 'http://localhost:1725/EmployeeDetails/EmpDet.aspx?op=search',
    reader: {
    type: 'json',
    root: 'result.message'
    }
    }
    })


    });




    var searchlistpanel=new Ext.Panel({
    style:'background-color:#d0e4fe;',

    dockedItems:[{xtype:'toolbar',title:'Products',items:[{ui:'back',text:'back',
    handler:function()
    {
    searchpanel.setActiveItem(searchform);
    }
    }]},{xtype:'toolbar'}],
    items:[searchlist]
    });


    var searchform=new Ext.form.FormPanel({
    bodyStyle:'background-color:#d0e4fe;',


    dockedItems:[{xtype:'toolbar',title:'Home',items:[{xtype:'spacer'},{ui:'confirm',text:'LogIn'}]}],


    items:[{xtype:'searchfield',id:'search',width:260,style:'position:absolute;top:200px;left:250px;margin:2%'},
    {xtype:'button',ui:'confirm',text:'Search',width:120,style:'position:absolute;top:205px;left:520px;margin:2%',
    handler:function()
    {
    searchpanel.setActiveItem(searchlistpanel);
    }
    }]
    });




    var searchpanel=new Ext.Panel({
    fullscreen:true,
    style:'background-color:#d0e4fe;',
    layout: {
    type: 'card',
    },
    items:[searchform]


    });
    }
    });
    Last edited by sathyan_8294; 22 Nov 2011 at 9:19 PM. Reason: coding

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar