Sigma Php Ajax framework, Ajax Components, GUI Builder
May 23, 2012, 09:24:04 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: creating serial number for each number  (Read 679 times)
prabhuraj
Full Member
***
Posts: 26


View Profile
« on: March 12, 2011, 12:40:04 AM »

Hi , i am using sigma grid in my application , i have to show the row numbers , but the row number starts with 1 and goes up to the number of records in that page , if we go the next page the row number , again starts with 1 , this does not suits for me , as per our requirement , it have to continue the previous row number in the previous grid .

Can you help me in that situation .. Thanks in Advance
Logged
prabhuraj
Full Member
***
Posts: 26


View Profile
« Reply #1 on: March 12, 2011, 03:58:33 AM »

I have a solution but still it willnot be showing correct in 2nd page



var colsOption = [
   {id: 'sid' , header: "Sid" , width :70 ,renderer:function(value,record,colObj,grid,colNo,rowNo)
{
 var cValue=rowNo+1;
 return cValue;
}},
           {id: 'qty' , header: "Qty" , width :130,  editor:{type:'text',validRule:['R','F']}},
      {id: 'rate' , header: "Rate" , width :130,  editor: { type :"text",validRule:['R','F']}},
      {id: 'amount' , header: "Amount" , width :130 ,  editor: { type :"text",validRule:['R','F']}}
   ];
Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #2 on: March 12, 2011, 04:33:33 AM »

You can use "getNumberedStr" function to custom the number format:

Class('App', 'linb.Com',{
    Instance:{
        iniComponents : function(){
            // [[code created by jsLinb UI Builder
            var host=this, children=[], append=function(child){children.push(child.get(0))};
           
            append(
                (new linb.UI.Pane)
                .setHost(host,"ctl_pane6")
                .setLeft(80)
                .setTop(30)
                .setWidth(610)
                .setHeight(330)
            );
           
            host.ctl_pane6.append(
                (new linb.UI.TreeGrid)
                .setHost(host,"ctl_treegrid2")
                .setRowNumbered(true)
                .setHeader([{"id":"col1", "width":80, "type":"label", "caption":"col1"}, {"id":"col2", "width":80, "type":"label", "caption":"col2"}, {"id":"col3", "width":80, "type":"label", "caption":"col3"}, {"id":"col4", "width":80, "type":"label", "caption":"col4"}])
                .setRows([{"cells":[{"value":"row1 col1", "id":"c_a", "oValue":"row1 col1"}, {"value":"row1 col2", "id":"c_b", "oValue":"row1 col2"}, {"value":"row1 col3", "id":"c_c", "oValue":"row1 col3"}, {"value":"row1 col4", "id":"c_d", "oValue":"row1 col4"}], "id":"a"}, {"cells":[{"value":"row2 col1", "id":"c_e", "oValue":"row2 col1"}, {"value":"row2 col2", "id":"c_f", "oValue":"row2 col2"}, {"value":"row2 col3", "id":"c_g", "oValue":"row2 col3"}, {"value":"row2 col4", "id":"c_h", "oValue":"row2 col4"}], "id":"b"}, {"cells":[{"value":"row3 col1", "id":"c_i", "oValue":"row3 col1"}, {"value":"row3 col2", "id":"c_j", "oValue":"row3 col2"}, {"value":"row3 col3", "id":"c_k", "oValue":"row3 col3"}, {"value":"row3 col4", "id":"c_l", "oValue":"row3 col4"}], "sub":[["sub1", "sub2", "sub3", "sub4"]], "id":"c"}])
                .setCustomFunction({
                    getNumberedStr:function(numb){
                        return numb+"-";
                    }
                })
            );
           
            return children;
            // ]]code created by jsLinb UI Builder
        }
    }
});
Logged
terrytrue
Newbie
*
Posts: 1


View Profile WWW
« Reply #3 on: May 19, 2011, 02:00:14 AM »

 Undecided if we go the next page the row number , again starts with 1 , this does not suits for me , as per our requirement , it have to continue the previous row number in the previous grid .   Kiss Cry
Logged

khagans
Full Member
***
Posts: 20


View Profile
« Reply #4 on: May 27, 2011, 04:53:17 AM »

Disable the row numbering in the TreeGrid control and create you own column for row number.  Populate it along with your page data when you update the grid.

If you know what page you are on, and you know the number of rows per page, then you can calculate the starting number of each page.  You have control over both the page number and the number of rows.  Thus, if you are displaying 20 rows per page, and you are on page 5, then you should sequence your next set of row numbers starting at 101.

(5*20) + 1 = 101

Simply have your server-side script return row numbers with the data hash.

Alternatively, you can simply include the row ID from the database in your hash (if your database supports row IDs and it is an appropriate value for your application).
« Last Edit: May 27, 2011, 04:57:46 AM by khagans » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!