Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by banmidou on May 14, 2009 11:33
open dhtmlx forum
How to add column with DhtmlGrid - connector.

I just want to add more some column such as delete,update which doesn't exist in table... with DhtmlGrid - connector before sending data to client.
Example ,with delete column, each cell will return a image link to function to delete it's row. It will be more comfortable than click "delete row" button.
Can you show me how to do it.
Sorry for my bad english.
Thanks.
Answer posted by Support on May 15, 2009 03:05
You can use 
  $grid->event->attach("beforeRender",function($data){
               $data->set_value("dummy1","<img src='some.gif'>");           
               $data->set_value("dummy2","<img src='other.gif'>");           
  })
  $grid->render("table","id","fieldA,fieldB,fieldC,0(dummy1),0(dummy2)")


Answer posted by banmidou on May 15, 2009 07:46
Thanks for you support.
Now , i want to add some more column with render->sql.
Please help me.
Thanks again.

Answer posted by Support on May 18, 2009 04:51
You can use the similar approach

  $grid->render_table("table","id","fieldA,fieldB,fieldC,0(dummy1),0(dummy2)")

equal to 

  $grid->render_sql("select *, 0 as dummy1, 0 as dummy2 from table","id","fieldA,fieldB,fieldC,dummy1,dummy2")