Adding a Link Column when using ASP Processor

Hi,

I’m using dhtmlxGrid with the beta ASP Connector to connect to a MySQL database. All is working fine but I want a column which has an image (an icon) that links to another page and using the ID of the selected row as part of a querystring (i.e. the link should look like “product-edit.asp?prodId=X” where X is the ID of the current row).

I thought I’d cracked it by creating the link URL in my database SELECT statement (lots of CONCAT’s) and referring to it as “prodlink”

 "SELECT CONCAT(img/edit.gif^click to edit this product^product-edit.asp?prodId=',CONVERT(prodId, CHAR(8)),'_self') as prodlink, etc"

I then referred to that column in my grid code and set the column type to “img” - everything worked fine, the icon displayed and linked to my product-edit.asp page and passed the variable in the querystring. However when I tried to edit any line on the grid I got an error stating that “prodlink” (my concatenated link URL in the SELECT statement) did not exist in the database (which it doesn’t).

So how can I add a column to my grid that displays an image (img/edit.gif) that links to product-edit.asp?prodId=X (where X is the ID of the current row) but doesn’t intefere with the editing/updating of the grid.

All the help files seem to just refer to using an XML file which I’m not using so I’m a bit stuck.

Any help would be greatly appreciated.

Try to use “beforeRender” connector event to format “img” cell in necessary way
docs.dhtmlx.com/doku.php?id=dhtm … ng_methods

Or you can use “beforeProcessing” event and call “remove_field prodlink” from event handler docs.dhtmlx.com/doku.php?id=dhtm … processing

Hi,

Thanks for your response but I’m unclear where to put the code and how the code should look.

The beforeProcessing method seems the easiest but where do I put the beforeProcessing code, the bottom of mygrid code looks like:

[code] mygrid.enableSmartRendering(true)
mygrid.enableMultiselect(false)
mygrid.init();
mygrid.loadXML(“datagrid/mydatasource.asp?catId=<%=catId%>”);

var dp = new dataProcessor("datagrid/mydatasource.asp?catId=<%=catId%>");
dp.init(mygrid);[/code]

where would I put beforeProcessing and what would the code look like to tell it to remove prodlink?

I’ve looked at the code for beforeUpdate (grid.m_event.attach “beforeUpdate”, array(myUpdate)) but I’m still stuck.

Any help will be appreciated.

Also could you explain the process if I wanted to remove 2 fields before processing (as I might want to add another link to the grid).

Thanks.

where would I put beforeProcessing and what would the code look like to tell it to remove prodlink?
beforeRender and beforeProcessing is an events of dhtmlxConnector object. You should put beforeProcessing at the file where you initialize dhtmlxConnector object.