Results 1 to 2 of 2

Thread: Please Help Me - Suggest Example Using XML Reader

  1. #1

    Default Please Help Me - Suggest Example Using XML Reader

    Hi

    I dont know how to filter out xml data.


    I want to display the xml data while entering input in input box. I am using xml reader to read the xm data. Actually it display all the xml data.

    It display lie forum search example template.

    Can any one help me to solve this?


    My xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <records total="2">
    <user>
    <id>1</id>
    <firstName>Arun</firstName>
    <lastName>Ram</lastName>
    <class>X</class>
    <sec>A</sec>
    <sonordaugof>Ram Naresh</sonordaugof>

    </user>
    <user>
    <id>2</id>
    <firstName>Arun</firstName>
    <lastName>Ram</lastName>
    <class>X</class>
    <sec>A</sec>
    <sonordaugof>Ram Naresh</sonordaugof>

    </user>
    <user>
    <id>3</id>
    <firstName>Bala</firstName>
    <lastName>Ram</lastName>
    <class>X1</class>
    <sec>C</sec>
    <sonordaugof>Ram Naresh</sonordaugof>

    </user>
    <user>
    <id>4</id>
    <firstName>Chandramouli</firstName>
    <lastName>Krishnan</lastName>
    <class>IV</class>
    <sec>A</sec>
    <sonordaugof>Krishnan Shankar</sonordaugof>

    </user>
    </records>

    when i type a in input it should display only arun, arun.

    My js file


    var store = new Ext.data.Store({


    // load using HTTP
    url: 'sample.xml',

    // the return will be XML, so lets set up a reader
    reader: new Ext.data.XmlReader({


    record: 'user',
    id: 'id'
    ,totalRecords: '@total'
    ,remoteSort:true
    }, [
    {name: 'id', type: 'int'},
    {name: 'firstName'},
    {name: 'lastName'},
    {name: 'class'},
    {name: 'sec'},
    {name: 'sonordaugof'}
    ])
    });

    // Custom rendering Template
    var resultTpl = new Ext.XTemplate(
    '<tpl for="."><div class="search-item">'
    ,'<h3><span>{id}{firstName} </span></h3>'
    ,'Son/Daughter of {sonordaugof}<br>',
    '{class}' ,
    '{sec} Section' ,
    '</div></tpl>'
    );

    var search = new Ext.form.ComboBox({


    store: store,
    displayField:'firstName',
    typeAhead: true,
    loadingText: 'Searching...',
    width: 570,
    pageSize:10,
    //minChars:2,
    hideTrigger:true,
    queryParam:'firstName',
    tpl: resultTpl,
    applyTo: 'search',
    itemSelector: 'div.search-item',
    onSelect: function(record){ // override default onSelect to do redirect
    window.location =
    String.format('student.html');
    }
    });
    });

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    40 posts and you don't know to use the code tags when posting?!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •