1. #1
    Sencha User
    Join Date
    Dec 2012
    Location
    hyderabad
    Posts
    52
    Vote Rating
    0
    javapurna is on a distinguished road

      0  

    Default Answered: pagination

    Answered: pagination


    hi ,
    i am using extjs 4 . i have a grid that contains pagination tab. i am deleting all all records from page 2 that page shows empty page and hiding next button and previous buttons. user have no chance to move 1 page or 3 page migration.

    Screenshot.jpg

    my code like ...
    model
    Ext.define('zeekocem.model.User', {
    extend: 'Ext.data.Model',
    fields: [
    {name: 'id',type:'int'},
    {name:'name',type:'string'},
    {name:'password',type:'string'},
    {name:'userId',type:'string'},
    {name:'email',type:'string'},
    {name:'phoneNumber',type:'int'},
    {name:'role',type:'int'},
    {name:'allowedNotification',type:'string'},
    {name:'allowSystemAlerts',type:'string'}

    ]
    });

    Store

    Ext.define('zeekocem.store.UserPagination', {
    extend: 'Ext.data.Store',
    model: 'zeekocem.model.User',
    autoLoad: false,
    storeId: 'UserPagination',
    pageSize:10,

    proxy:{
    type: 'rest',
    urlerviceUrl+'admin-service/users',
    reader: {
    type: 'json',
    root: 'Userpagination.user',
    totalProperty: 'Userpagination.totalUsers'
    },

    afterRequest:function( request, success )
    {

    },
    headers: {
    'Content-Type': 'application/json; charset=utf-8'
    }


    }

    });


    my rest service method here...
    @GET
    @Path("/users")
    public UserpaginationDTO getUsers(@QueryParam("start") int start, @QueryParam("limit") int limit) throws DomainException , SystemException ;


    my dao login here ....
    @Override
    public UserpaginationDTO getUsers(int start,int limit) throws DomainException, SystemException {
    logger.info("Entering in :< [AdminDaoImpl][getUsers] >");
    Session session = getSession() ;
    List<UserpaginationDTO> usersListCount = new ArrayList<UserpaginationDTO>() ;
    UserpaginationDTO userpagination=new UserpaginationDTO();
    List<User> usersList = null ;
    try{
    if(limit== -1){
    limit=999999999;
    }
    usersListCount=session.createCriteria(User.class).list();
    usersList = session.createCriteria(User.class).setFirstResult(start).setMaxResults(limit).addOrder(Order.desc("id")).list() ;
    userpagination.setUser(usersList);
    userpagination.setTotalUsers(usersListCount.size());
    }catch(Exception e){
    logger.error("Exception Occured",e) ;
    }finally{
    releaseSession(session) ;
    logger.info("Exit from :< [AdminDaoImpl][getUsers] >");
    return userpagination;
    }
    }

    please help any one .

  2. When you remove the records from the store, you could load the store to get an update in the total count and get things back in line.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,684
    Vote Rating
    435
    Answers
    3111
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    When you remove the records from the store, you could load the store to get an update in the total count and get things back in line.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Location
    hyderabad
    Posts
    52
    Vote Rating
    0
    javapurna is on a distinguished road

      0  

    Default


    Quote Originally Posted by javapurna View Post
    hi ,
    i am using extjs 4 . i have a grid that contains pagination tab. i am deleting all all records from page 2 that page shows empty page and hiding next button and previous buttons. user have no chance to move 1 page or 3 page migration.

    Attachment 41181

    my code like ...
    model
    Ext.define('zeekocem.model.User', {
    extend: 'Ext.data.Model',
    fields: [
    {name: 'id',type:'int'},
    {name:'name',type:'string'},
    {name:'password',type:'string'},
    {name:'userId',type:'string'},
    {name:'email',type:'string'},
    {name:'phoneNumber',type:'int'},
    {name:'role',type:'int'},
    {name:'allowedNotification',type:'string'},
    {name:'allowSystemAlerts',type:'string'}

    ]
    });

    Store

    Ext.define('zeekocem.store.UserPagination', {
    extend: 'Ext.data.Store',
    model: 'zeekocem.model.User',
    autoLoad: false,
    storeId: 'UserPagination',
    pageSize:10,

    proxy:{
    type: 'rest',
    urlerviceUrl+'admin-service/users',
    reader: {
    type: 'json',
    root: 'Userpagination.user',
    totalProperty: 'Userpagination.totalUsers'
    },

    afterRequest:function( request, success )
    {

    },
    headers: {
    'Content-Type': 'application/json; charset=utf-8'
    }


    }

    });


    my rest service method here...
    @GET
    @Path("/users")
    public UserpaginationDTO getUsers(@QueryParam("start") int start, @QueryParam("limit") int limit) throws DomainException , SystemException ;


    my dao login here ....
    @Override
    public UserpaginationDTO getUsers(int start,int limit) throws DomainException, SystemException {
    logger.info("Entering in :< [AdminDaoImpl][getUsers] >");
    Session session = getSession() ;
    List<UserpaginationDTO> usersListCount = new ArrayList<UserpaginationDTO>() ;
    UserpaginationDTO userpagination=new UserpaginationDTO();
    List<User> usersList = null ;
    try{
    if(limit== -1){
    limit=999999999;
    }
    usersListCount=session.createCriteria(User.class).list();
    usersList = session.createCriteria(User.class).setFirstResult(start).setMaxResults(limit).addOrder(Order.desc("id")).list() ;
    userpagination.setUser(usersList);
    userpagination.setTotalUsers(usersListCount.size());
    }catch(Exception e){
    logger.error("Exception Occured",e) ;
    }finally{
    releaseSession(session) ;
    logger.info("Exit from :< [AdminDaoImpl][getUsers] >");
    return userpagination;
    }
    }

    please help any one .






    thanks so mush Mitchell Simoens