Grid cell link type from SQL questions

DHTMLX Suite 4.4 Pro

My Grid data is being rendered from a SQL table.

How do I create links in a Grid column, with column type ‘link’, where the SQL data for the column would be the link text? I read in the documentation how to create an XML file structure for this but since my data is coming from a DB via render_table, how can I do this? I am using the Php sqlsrv connector. Is there some way I can insert the links I want for each row via Php or is there a Grid method that I missed that I can use to do this?

Thank you,

You may try to use the “link” column type.
Here you can find a tutorial about the required format of the value incoming from the server:
docs.dhtmlx.com/grid__columns_ty … inkscolumn

Semtik, thank you for the reply. I do have my column set to ‘link’ type and that is working. I am trying to ask, is there a way, using the render_table and the data processor, to combine two sql column values, or a sql value and a php variable to create the link entry for the grid column?

I know I could do this by creating an array of values in php then do a render_array to the Grid but, I would then not be able to use the data processor to write back to the DB without creating another custom script, correct?

Is it possible to render to the Grid with one connector (render_array), then use another connector with the data processor to write back (render_table)?

You can use beforeRender event handler on server side to format values from DB, it can be used to form the data as it necessary for “link” column in a dhtmlxGrid.

docs.dhtmlx.com/connector__php__formatting.html
docs.dhtmlx.com/connector__php__ … event.html

Thank you Stan! Exactly what I was missing and looking for. I was just having a hard time trying to explain it at first.

Thank you to both of you for your help and great work.

Stanislav, I have successfully been able to create the links for the Grid using the ‘beforeRender’ event as you suggested.

However, there is now a problem with writing data back to the database using the dataprocessor.

The ‘name’ value from the database is simply:
‘somename’

Using the beforeRender event the name value is rendered to the Grid as:
‘somename^http://theurl.com^_blank’

Using the dataprocessor, it now tries to write the values of the grid row (including the name) back to the database as the rendered ‘name’ value (‘somename^http://theurl.com^_blank’) instead of the correct value, which should be just the name without the link syntax (‘somename’) and fails.

How can I write only the grid cell ‘name’ value without the link syntax back to the database?

What if I wanted to write a grid row, excluding a cell, to the database via the dataprocessor?

Thank you,

What if I wanted to write a grid row, excluding a cell, to the database via the dataprocessor?

For PHP connector code will look like follows

function beforeSaveHandler($action){
  $action->remove_field("linkColumnName");
}
$conn->event->attach("beforeProcessing", "beforeSaveHandler")

docs.dhtmlx.com/connector__php__ … event.html
docs.dhtmlx.com/connector__php__ … emovefield

Thank you. I apologize for asking questions with answers that are clearly documented but even using Google to search the documentation I don’t always find what I’m looking for.

One day I will hopefully have a better handle on all the methods.