Tuesday, 15 January 2013

php - how to dynamically fill the datatable for one column static pressures or big -



php - how to dynamically fill the datatable for one column static pressures or big -

this array of object stored in itemgroup.

$itemgroup: 0: {static_pressure:19.85, fan_dia:500, fan_rpm:1400, fan_series_name:afpv3g, blade_angle_value:26.00,…} 1: {big:20.19, fan_dia:500, fan_rpm:1400, fan_series_name:afpv3g, blade_angle_value:26.00, fan_cmh:1000,…} 2: {big:141.74, fan_dia:600, fan_rpm:2800, fan_series_name:afpv3g, blade_angle_value:25.00, fan_cmh:1000,…} 3: {big:91.10, fan_dia:500, fan_rpm:2800, fan_series_name:afpv3g, blade_angle_value:25.00, fan_cmh:1000,…}

jquery datatable array of objects ajax response filled here in datatable

$('#sample').datatable({ "bdestroy": true, "bprocessing": true, "aadata": data.itemgroup, responsive: true, "aocolumns": [ {"mdata":null, "mrender": function (o) {return '<input type="checkbox" name="active[]" id="active" class="active" >';} } , {"mdata": "fan_series_name"}, {"mdata": "fan_dia"}, {"mdata": "fan_rpm"}, {"mdata" :"blade_angle_value"}, {"mdata": "fan_cmh"}, {"mdata": "bkw"}, // {"mdata": "el_frequency"}, // {"mdata": "static_pressure"}, {"mdata":"static_pressure", "mrender": function (data, type, full) { // if(data==static_pressure) homecoming info ; // else //return info ; }, // "atargets":[0], } , {"mdata":"outlet_velocity"}, {"mdata":"velocity_pressure"}, {"mdata":"total_eff"}, {"mdata":"static_eff"} ] });

please help have fill column static pressure level 2 different variable big , static_pressure dynamically.. how can do?

if want dynamically render column can utilize column.

{"mdata": function ( source, type, val ) { if(source.static_pressure){ return(source.static_pressure); }else{ return(source.big); } } }

the code straightforward. if static_pressure exists render else render big.

i didn't knew existed. question. learned new :)

php jquery laravel datatable

No comments:

Post a Comment