Results 1 to 3 of 3

Thread: pagination

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Location
    hyderabad
    Posts
    91
    Answers
    1
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Location
    hyderabad
    Posts
    91
    Answers
    1
    Vote Rating
    0
      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.

    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 .






    thanks so mush Mitchell Simoens

Posting Permissions

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