1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    2
    Vote Rating
    0
    Alextom is on a distinguished road

      0  

    Default Unanswered: Using ExtJs, a problem occurred when xml data received and paging

    Unanswered: Using ExtJs, a problem occurred when xml data received and paging


    Hi all!

    Using ExtJs, I m testing to transfer received xml data to specific grid.
    I made a simple text file which has 10 output values , and set pageSize to 5 from paging toolbar.


    That is, the desired output for 10 values could be 5 values on each pages(2 pages).
    It divided to 2 pages correctly, however there are 10 same values on each pages.


    What is the cause for above problem?
    I hope your comments will be possible solutions.


    Thank you!

    ////////////////////////////////////////////////////////////////////////////
    test
    ////////////////////////////////////////////////////////////////////////////
    Ext.onReady(function(){
    var mm = Ext.data.Record.create([
    {name: 'mb_id'},
    {name: 'mb_sex'},
    {name: 'mb_name'}
    ]);




    var store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url:'./data.php'
    }),


    reader: new Ext.data.XmlReader(
    {
    record: 'Item'
    },[
    'mb_id'
    ,'mb_sex'
    ,'mb_name'
    ]
    ),
    autoLoad: true
    });




    var grid = new Ext.grid.GridPanel({
    renderTo: document.body,
    frame:true,
    title: 'User Information',
    height:300,
    width:516,
    store: store,
    columns: [
    {header: "ID", dataIndex: 'mb_id'},//, renderer: cover_image
    {header: "SEX", dataIndex: 'mb_sex',width:100},
    {header: "NAME", dataIndex: 'mb_name',width:100}
    ],
    bbar:new Ext.PagingToolbar({
    pageSize:5,
    storetore
    })
    });


    });


    ////////////////////////////////////////////////////////////////////////////
    data.php
    ////////////////////////////////////////////////////////////////////////////


    header("Content-type: application/xml"); //;charset=utf-8
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";


    echo "<root>";
    for($i=0;$i<10;$i++)
    {


    echo "<Item>";
    echo "<mb_id>".$i."</mb_id>";
    echo "<mb_sex>".$i."</mb_sex>";
    echo "<mb_name>".$i."</mb_name>";
    echo "</Item>";
    }
    echo "</root>";


    ////////////////////////////////////////////////////////////////////////////

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,077
    Answers
    674
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Typically paging is designed to return the total count (10 records) and then only the records that you want per page ( 5 records ) .. you are sending 10.

    If you want to use memory data, then have a look a PagingMemoryProxy

Thread Participants: 1

Tags for this Thread