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 Info',
    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,
    store: store
    })
    });


    });


    ////////////////////////////////////////////////////////////////////////////
    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 Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,490
    Answers
    526
    Vote Rating
    283
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Please post in the correct forum. Your question appears to be about ExtJS 3, not ExtJS 4.

    Paging must be implemented server-side. Setting the pageSize will not chunk up the data into pages for you.

    There are 3 parameters on the request (page, start and limit) that you can use to determine which results to return. There is some overlap in these 3 parameters, just use whichever combination suits your use case.

Thread Participants: 1

Tags for this Thread