EasyUI Forum
September 13, 2025, 08:31:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Server side datagrid - incorret rownumber  (Read 10702 times)
vilish
Newbie
*
Posts: 2


View Profile Email
« on: November 13, 2014, 12:16:53 PM »

Hi, I implemented a Server side easyui-datagrid and everything looks fine except the rownumbers.

my server side java code populates the right data into the grid and using following code, i correct the pagination.

   $(document).ready(function () {
      var pager = $('#tt').datagrid('getPager');
      if(pgNum.value!=''  ){ // pgNum hidden variable tell the which page i am
         pager.pagination({
                 pageNumber:pgNum.value,
               showPageList:false
         });
   });

Now because of rownumbers:true defined in data-options, pagination initializes the row numbers.

So although i am on a 3rd (or some other) page and data and pagination showing right numbers, rownumbers are still 1,2,3,......if i click on refresh button, it correct them.

Could some jquery expert can help me to correct the  problem. I am mainly a java develioper and trying jquery first time.

Thank you,

Vilish

now since
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: November 13, 2014, 04:54:27 PM »

The 'rownumbers' is the built-in functionality in the datagrid component. You do not need to implement it by yourself. Please try the code below:
Code:
$('#dg').datagrid({
  rownumbers: true,
  idField: ...,
  pagination:true
});
Logged
vilish
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: November 14, 2014, 12:50:39 PM »

I know rownumber is there and gets initialed with rownumbers:true defined in data-options.

well i was going to a different page and from there i am supposed to return on the same page on the datagrid page.

Well i resolved this after reading many topics on the forum. here to the way to correct the rownumbers

$(document).ready(function () {
      var opts = $('#tt').datagrid('options');
      var pager = $('#tt').datagrid('getPager');
      if(pgNum.value!='' && pgSize.value!='' ){ // pgNum and pgSize hidden variable tell the which page i am and row count respectively.
            opts.pageNumber = pgNum.value;
         opts.pageSize = pgSize.value;
         pager.pagination({
                 pageNumber:pgNum.value,
               showPageList:false
         });
      }
   });
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!