DaltonPimmel / flexigrid

Automatically exported from code.google.com/p/flexigrid
0 stars 0 forks source link

browser Opera display text "null" in cells with null-data #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
typical code:

$grid = array();
$grid['rp'   ] =
$grid['page' ] =
$grid['query'] =
$grid['qtype'] =
$grid['sortname' ] =
$grid['sortorder'] =
$grid['total'] =
$grid['rows' ] = array();

foreach( $res as $arr ) {//$res ~ select query result
  $grid['rows'][] = array(
    'id'  => 'grid01'. $arr['id'],
    'cell'=> array( $arr['name'],$arr['desc'],$arr['status'] )
  );
}
return json_encode( $grid ); 

Server-side PHP script load data from DB. DB-result may contain NULL-values. 
This values come to grid and in different browsers displayed differently.
In IE, Firefox, Chrome NULL-values don't displayed. In Opera I see text 'null'.

My patch: in flexigrid addData 
change lines (2 times)
    td.innerHTML = row.cell[idx];

with line
    td.innerHTML = ( row.cell[idx] != null ) ? row.cell[idx] : '';

Original issue reported on code.google.com by ymkin....@gmail.com on 7 Mar 2011 at 10:55

GoogleCodeExporter commented 8 years ago
Fixed and pushed to trunk.

Original comment by eric.caron on 22 Apr 2011 at 10:28