Sigma Php Ajax framework, Ajax Components, GUI Builder
May 24, 2012, 10:33:58 AM *
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: In sigmagrid , how to set the cell's background color??  (Read 1555 times)
luoluo99999
Newbie
*
Posts: 1


View Profile
« on: September 14, 2009, 08:15:21 PM »

In sigmagrid , how to set the cell's background color??
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #1 on: September 14, 2009, 11:58:16 PM »

That's easy. Do a customized render
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
kapteng
Newbie
*
Posts: 4


View Profile
« Reply #2 on: September 18, 2009, 01:19:51 AM »

i have global render function for all columns, like this:

                // Initial Renderer
      if( value.length>5 && value.indexOf("Calc-")==0 ){         
         return "<span style=\"background-color:yellow\"><strong>"+value.substr(5)+"</strong></span>";
      }
      if( value.length>4 && value.indexOf("Imp-")==0 ){         
         return "<span style=\"background-color:SkyBlue\"><strong>"+value.substr(4)+"</strong></span>";
      }
      if(value=="&&"){
         record[columnObj.fieldIndex] = "N/A";
         return "<span style=\"background-color:gray\"><strong>N/A</strong></span>";
      }      
      return value ;


how can i keep the background color in every numeric entry in the grid ?
here is the screenshot


Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #3 on: September 22, 2009, 10:35:19 PM »

You have to specify renderer for each columns.  Sad Sad Sad
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
kapteng
Newbie
*
Posts: 4


View Profile
« Reply #4 on: September 22, 2009, 10:59:38 PM »

i can't do that, because my data source from XML with the number of columns that are not fixed.
every data column with prefix "Calc-" will be change the background color with yellow, "Imp-" with bluesky, and "&&" with "gray".
i have try many way, and failed.
maybe you can help me with how to intercept value updated when we update the cell in editor text,
so i can reformat per cell value to make the renderer function works for every data cell updated.
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #5 on: September 22, 2009, 11:12:54 PM »

where did you define the column model? can you do the following lines?
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
kapteng
Newbie
*
Posts: 4


View Profile
« Reply #6 on: September 22, 2009, 11:27:02 PM »

i define column model with the script below,
the script read XML data from dsXML (XML data type in HTML)

function extractXMLDataSet(){
         var   nodes = dsXML.XMLDocument.childNodes.item(0).childNodes;
         strArrayData = "_DATA_ = [";
         strDsOption = "dsOption= { fields :[ ";
         strColsOption = "colsOption = [   ";
         strImacsVarProperty = " imacsVarProperty = [  ";

         for(row=0; row<nodes.length; row++){
            strArrayData +="[";
            for(column=0; column < nodes[row].childNodes.length; column++){
               strArrayData += "\""+nodes[row].childNodes[column].text+"\"";
               if(column != nodes[row].childNodes.length-1) strArrayData+=",";

               //process column name for dsOption and colsOption, get all column name, for first row only
               if(row==0){
                  //dsOption
                  strDsOption +="{name : '"+ nodes[row].childNodes[column].baseName + "'  }";

                  //strColsOption += "{id: '"+nodes[row].childNodes[column].baseName+"' , header: \""+nodes[row].childNodes[column].baseName+"\",width:80 }";
                  strColsOption += "{";
                  strColsOption += " id: '" + nodes[row].childNodes[column].baseName +"' ,";
                  strColsOption += " header:\"" + nodes[row].childNodes[column].baseName + "\",width:80";
                  strColsOption += (column<4? ",frozen:true":",renderer:my_renderer, editor:{type:\"text\", validator:my_validator}" );
                  strColsOption += "}";

                  //for imacs var property
                  strImacsVarProperty += " { "
                  //check if end of column no
                  if(column != nodes[row].childNodes.length-1){
                     strDsOption += ",";
                     strColsOption += ",";
                  }
               }
            }
            strArrayData +="]";

            if(row!= nodes.length-1) strArrayData +=",";

         }
         strArrayData +="]";
         strDsOption +="   ],recordType : 'array',   data : _DATA_}";
         strColsOption +="]";
         strImacsVarProperty = " ]; ";
}
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #7 on: September 22, 2009, 11:44:38 PM »

can you append "renderer: gRenderer" in each line
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
kapteng
Newbie
*
Posts: 4


View Profile
« Reply #8 on: September 22, 2009, 11:56:09 PM »

i had it, see:

renderer:my_renderer, editor:{type:\"text\", validator:my_validator}" );
                  strColsOption += "}";
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!