Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 10:38:20 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: Cell renderer can not be turned off for a cell  (Read 464 times)
ludwigl
Sr. Member
****
Posts: 47


View Profile
« on: August 09, 2010, 05:24:24 AM »

Hi linb,

I am using V3.0 R939 and I am failing to turn off a cellRenderer which is defined for a column in the header specification.
Please see the following code:

          host.ctl_pane16.append(
                (new linb.UI.TreeGrid)
                .setHost(host,"ctl_treegrid5")
                .setRowNumbered(true)
                .setHeader([{"id":"col1", "width":80, "type":"number", "caption":"col1", "cellRenderer":function (i, oi) {
                    alert("in CellRenderer with value " + i.value); // only for debugging purposes
                    return Number(Math.round(i.value * 100) / 100).toFixed(2);}},
                                {"id":"col2", "width":80, "type":"label", "caption":"col2"}])

                .setRows([{"cells":[{"value":1.229, "id":"c_a", "oValue":1.229}, {"value":"r1c2", "id":"c_b", "oValue":"r1c2"}], "id":"e"},
                              {"cells":[{"value":"", "id":"c_a", "type":"label", "cellRenderer":null, "oValue":""}, {"value":"", "id":"c_b", "oValue":""}], "id":"f"},
                              {"cells":[{"value":1.506, "id":"c_a", "oValue":1.506}, {"value":"r3c2", "id":"c_b", "oValue":"r3c2"}], "id":"g"}])
            );


In previous releases (Version 2.2) row two in the grid was empty, which was the intended behaviour, now the string "0.00" is displayed, because the cellRenderer function is executed, although I set it to "null" for this specific cell.

Is this a bug or change in behaviour?
In case it is not a bug, how can I output an empty row in my example.

Thanks in advance for your help,

Ludwig
Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #1 on: August 09, 2010, 05:53:16 AM »

"cellRenderer":function (i, oi) {

return typeof i.value=="number" ? Number(Math.round(i.value * 100) / 100).toFixed(2) : "";

}
« Last Edit: August 09, 2010, 07:49:43 AM by linb » 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!