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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,121
    Answers
    3504
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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

      0  

    Default to search

    to search


    hai mitchellsimoens....thanks for reply...
    i can't understand u sended filter....i am new to this sencha plz help me...
    i want to search the records from sql database and also i want to display records from sql database in each textfield...plz help me....

  4. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    2
    Vote Rating
    0
    pradeepvbe@gmail.com is on a distinguished road

      0  

    Default


    hai all,
    i want to search the entered string in the search filed,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 it should list all the records starting with letter b...how to do these allthings in json???
    and how to diplay records from sql database in text field...can any one tell me plz how to do that??