Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by andreea on May 15, 2008 06:56
open dhtmlx forum
here is the code i use to create the xml for the grid


here is the code i use to create the xml for the grid :

 function createXmlFileTreeGrid4Filter($filePath, $tree=array(), $fp='', $resetCount=0) { static $callCount = 0; if ( $resetCount ) { $callCount = 0; } $callCount++; if( $callCount == 1 ) { $fp = fopen($filePath, 'w+'); fwrite($fp, '<?xml version='1.0' encoding='utf-8'?&gt;\n'); fwrite($fp, '<rows id='0'&gt;\n'); } foreach ($tree AS $t) { $isAttribute = (substr($t['id'],0,6)=='attrib')?true:false; fwrite($fp,'<row id='' . $t['id'] . '' '.(($t['checked'])?' open='1'':'').'&gt;'); fwrite($fp,'<cell &gt;'.(($t['checked'])?'1':'0').'</cell&gt;'); fwrite($fp,'<cell image=''. $t['img'] .'' &gt;'.$t['name'].'</cell&gt;'); if($isAttribute) { fwrite($fp,'<cell class=\'col_highlight\'&gt;'.(($t['operator'])?$t['operator']:'').'</cell&gt;\n'); fwrite($fp,'<cell class=\'col_highlight\'&gt;'.(($t['value1'])?$t['value1']:'').'</cell&gt;\n'); fwrite($fp,'<cell &gt;'.(($t['value2'])?$t['value2']:'').'</cell&gt;\n'); } if ( count($t['subtree']) ) { createXmlFileTreeGrid4Filter($filePath, $t['subtree'], $fp); } fwrite($fp, '</row&gt;\n'); } if( $callCount == 1 ) { fwrite($fp, '</rows&gt;\n'); chmod($filePath, 0766); fclose($fp); } $callCount--; } Here is the code in css : div.gridbox_light table.obj td.col_highlight { border-width: 1px 1px 1px 1px; border-left: 1px solid #D6D6D6; border-right: 1px solid #D6D6D6; border-top: 1px solid #D6D6D6; border-buttom: 1px solid #D6D6D6; font-family:Tahoma; font-size:11px; padding-right:4px; padding-left:4px; } as you can see fwrite($fp,'<cell &gt;'.(($t['value2'])?$t['value2']:'').'</cell&gt;\n');

 

 meaning the fourth cell has no class=col_highlight (like the previous two) I need this cell to get the class=col_highlight only if the user edits the third cell (not the fourth) on the same row and puts the value 'Between'

Answer posted by Support on May 15, 2008 07:28

mygrid.attachEvent("onEditCell",function(stage,id,ind,value){
         if (stage==2 && ind == 2 && value=="between"){
                  this.cells(id,3).cell.className="col_highlight";
         }

         return true;
})