Results 1 to 8 of 8

Thread: problem in paging

  1. #1

    Question problem in paging

    I am trying to add paging for my list in js.Its showing no of pages correctly in bbar as per the given pagesize limit.But its not filtering and it listing all data in the 1st page itself.If any one know please help me.

    This is my js code:

    Code:
    Ext.onReady(function(){
        var store = new Ext.data.GroupingStore({
            id:'store',
            url:'../crm/get_totaldb_list.jsp',
            autoLoad:true,
              reader:new Ext.data.ArrayReader({},[
               {name:'cusname'},
                {name:'mobileno'},
                {name:'cmpname'},
                {name:'location'},
                {name:'status'},
                {name:'camp_name'}, ])
        });
    var pagesize =5;
    var paging_toolbar = new Ext.PagingToolbar({
                 pageSize: pagesize,
                 displayInfo: true,
                 emptyMsg: 'No data found',
                 store: store
    });
        var grid = new Ext.grid.GridPanel({
            width:550,
            height:370,
             id:grid,
             renderTo:'CtlDBList',
            trackMouseOver:false,
            disableSelection:true,
            loadMask: true,
           columns:[new Ext.grid.RowNumberer(),
               {
                id: 'topic', 
                header: "Name",
                dataIndex: 'cusname',
                width: 200,
                sortable: true
            },{
                header: "Mobile No",
                dataIndex: 'mobileno',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Company Name",
                dataIndex: 'cmpname',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Location",
                dataIndex: 'location',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Status",
                dataIndex: 'status',
                hidden:true,
                width:'',
                align: 'right',
                sortable: true
            }],
           store:store,
           bbar:paging_toolbar
        })
        grid.render('topic-grid');
        store.load({params:{start:0,limit:pagesize}});
    });

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Your server has to only send what you ask it for!

  3. #3

    Red face paging

    Quote Originally Posted by Animal View Post
    Your server has to only send what you ask it for!
    Could you tell more about that

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    How would I know about that?

    You write your own server code.

    Maybe you use PHP, and I only know Java!

  5. #5

    Default paging

    Quote Originally Posted by Animal View Post
    How would I know about that?

    You write your own server code.

    Maybe you use PHP, and I only know Java!

    I use java and jsp only

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    So, query for just the chunk of data that was asked for in the start and limit params...

    Code:
        int start = Integer.parseInt(request.getParameter("start"), 10);
        int limit = Integer.parseInt(request.getParameter("limit"), 10);
    And pass those to whatever database you use to limit the page returned.

  7. #7

    Post paging

    These r my codes can u tell me where problem is

    Js code

    Code:
    Ext.onReady(function(){
    
        // create the Data Store
        var store = new Ext.data.GroupingStore({
            id:'store',
            url:'../crm/get_totaldb_list.jsp',
            autoLoad:true,
             //remoteSort: true,
            reader:new Ext.data.ArrayReader({},[
               {name:'cusname'},
                {name:'mobileno'},
                {name:'cmpname'},
                {name:'location'},
                {name:'status'},
                {name:'camp_name'}, ])
        });
    
    
    
        var grid = new Ext.grid.GridPanel({
            width:700,
            height:500,
            //title:'ExtJS.com - Browse Forums',
            store: store,
             renderTo:'CtlDBList',
            trackMouseOver:false,
            disableSelection:true,
            loadMask: true,
    
            // grid columns
    
           columns:[new Ext.grid.RowNumberer(),
               {
                id: 'topic', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
                header: "Name",
                dataIndex: 'cusname',
                width: 200,
               // ,renderer: renderTopic,
                sortable: true
            },{
                header: "Mobile No",
                dataIndex: 'mobileno',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Company Name",
                dataIndex: 'cmpname',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Location",
                dataIndex: 'location',
                width:'',
                align: 'right',
                sortable: true
            },{
                header: "Status",
                dataIndex: 'status',
                hidden:true,
                width:'',
                align: 'right',
                sortable: true
            }],
    
            // customize view config
    
            // paging bar on the bottom
            bbar: new Ext.PagingToolbar({
                pageSize:05,
                store: store,
                displayInfo: true,
                displayMsg: 'Displaying topics {0} - {1} of {2}',
                emptyMsg: "No topics to display"
            })
        });
    
        // render it
        grid.render('topic-grid');
    
        // trigger the data store load
        store.load({params:{start:0, limit:05}});
    });
    jsp code


    Code:
    <%@ page import="java.sql.SQLException" %>
    <%@ page import="com.eta.crm.*" %>
    
    <%@ include file="../common/nullif.jspf" %>
    
    <%
            campaign oCampaign = new campaign();
            String mkt = null;
    
    
    
            String FilterCondition = "where status='NO'";
    
    
            try {
    
                mkt = oCampaign.getMarketingDB(FilterCondition);
    
    
    
            } catch (SQLException e) {
    
                response.sendRedirect(response.encodeRedirectURL("../common/errmsg.jsp?title=Error&desc=" + e.getLocalizedMessage() + "&resume=_back"));
            }
            out.print(mkt);
    %>
    And the java method



    Code:
     public String getMarketingDB(String filtercond) throws SQLException {
            JDCConnection oConn = null;
            Statement oStmt = null;
            // Statement oStmt1 = null;
            StringBuffer MarketingDBList = new StringBuffer(1000);
            DBBind GlobalDBBind = new DBBind();
            oConn = GlobalDBBind.getConnection("MarketingDB");
    
            MarketingDBList.append("[");
            try {
                oStmt = oConn.createStatement();
                String chk = "SELECT name,mobileno,company_name,location,status,campaign_name,market_ref_id FROM tbl_market_db " + filtercond;
                ResultSet oRS1 = oStmt.executeQuery(chk);
                while (oRS1.next()) {
                    MarketingDBList.append("['" + Gadgets.nullif(oRS1.getString(1), "") + "','" + Gadgets.nullif(oRS1.getString(2), "") + "','" + Gadgets.nullif(oRS1.getString(3), "") + "','" + Gadgets.nullif(oRS1.getString(4), "") + "','" + Gadgets.nullif(oRS1.getString(5), "") + "','" + Gadgets.nullif(oRS1.getString(6), "") + "','" + Gadgets.nullif(oRS1.getString(7), "") + "'],");
                }
    
    
                oConn.close("MarketingDB");
            } catch (SQLException e) {
                try {
                    if (oStmt != null) {
                        oStmt.close();
                    }
                    if (oConn != null) {
                        if (!oConn.isClosed()) {
                            oConn.close("MarketingDB");
                        }
                    }
                } catch (Exception ignore) {
                }
            }
            MarketingDBList.append("]");
            return MarketingDBList.toString();
        }
    can any one tell me where error is

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    In your SQL!

    Read the manual for your database.

    You need to ask it to return only that page!

Posting Permissions

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