Author Topic: How to add class to single cells based on value of another cell.  (Read 2810 times)

hugmax

  • Newbie
  • *
  • Posts: 2
    • View Profile
I have this code in PHP.
I am adding rows and some qty cell has to be disabled (I add a class to the cell) if price is 0.
How can I do the same with pqgrid?

Code: [Select]
foreach ($result  as $p) {
                       
                        if($grupo != $p['grupo']){
                            echo '<tr><td class="celda-header-grupo" colspan="21">'.$p['grupo'].'</td></tr>';
                            $grupo = $p['grupo'];
                        }
                        if($subgrupo != $p['familia']){
                            echo '<tr><td class="celda-header-subgrupo" colspan="21">'.$p['familia'].'</td></tr>';
                            $subgrupo = $p['familia'];
                        }
                        if($familia != $p['gama']){
                            echo '<tr><td class="celda-header-familia" colspan="21">'.$p['gama'].'</td></tr>';
                            $familia = $p['gama'];
                        }
                        if($subfamilia != $p['subgama']){
                            echo '<tr><td class="celda-header-subfamilia" colspan="21">'.$p['subgama'].'</td></tr>';
                            $subfamilia = $p['subgama'];
                        }
                       
                        ?>
                    <tr>
                                                <td><?php echo $p['imagen']; ?></td>
<td><?php echo $p['nombre']; ?></td>
<td><?php echo $p['ref']; ?></td>
<td class="number"><?php echo $p['unidad']; ?></td>
<td class="number"><?php echo $p['blister']; ?></td>
<td class="number"><?php echo $p['cajaL']; ?></td>
<td class="number"><?php echo $p['cajaS']; ?></td>
<td class="number"><?php echo $p['palets']; ?></td>
<td class="number"><?php echo $p['display']; ?></td>
<td class="number" ><?php echo $p['priceUnit']; ?></td>
<td class="number"><?php echo $p['priceBlister']; ?></td>
<td class="number"><?php echo $p['priceCajaL']; ?></td>
<td class="number"><?php echo $p['priceCajaS']; ?></td>
<td class="number"><?php echo $p['pricePalet']; ?></td>
<td class="number"><?php echo $p['priceDisplay']; ?></td>
<td<?=($p['priceUnit']==0)?' class="unwritable"':' class="number editable"';?>><?php echo $p['pesoUnidad']; ?></td>
<td<?=($p['priceBlister']==0)?' class="unwritable"':' class="number  editable"';?>><?php echo $p['pesoBlister']; ?></td>
<td<?=($p['priceCajaL']==0)?' class="unwritable"':' class="number editable"';?>><?php echo $p['pesoCajaL']; ?></td>
<td<?=($p['priceCajaS']==0)?' class="unwritable"':' class="number editable"';?>><?php echo $p['pesoCajaS']; ?></td>
<td<?=($p['pricePalet']==0)?' class="unwritable"':' class="number editable"';?>><?php echo $p['pesoPalet']; ?></td>
<td<?=($p['priceDisplay']==0)?' class="unwritable"':' class="number editable"';?>><?php echo $p['pesoDisplay']; ?></td>
                   
                        </tr>
                    <?php    // el fin del foreach

best regards,

empy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to add class to single cells based on value of another cell.
« Reply #1 on: May 24, 2017, 02:41:25 pm »
my way if doing that for whole columns


Code: [Select]
$("#grid").pqGrid( 'getColumn', { dataIndx: xy}).editable = false;

for (i = 0; i < contentarray.length; i++){
  $("#grid").pqGrid( "addClass", {dataIndx: xy, rowIndx: i, cls: 'yourclass'} );
  }

$("#grid").pqGrid( "option" , "dataModel.data",contentarray );
$("#grid").pqGrid( "refreshDataAndView" );

hugmax

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to add class to single cells based on value of another cell.
« Reply #2 on: May 24, 2017, 11:51:14 pm »
thanks for reply.

I want to replicate this screen:

fotos a tamaņo real

With a sticky title bar, and also a footer.

regards