Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by LeitimMan on Dec 15, 2009 06:09
open dhtmlx forum
OptionsConnector not working with renderSQL

Hi,

I have a OptionsConnector to populate a coro box in a grid

$ContactOptions = new OptionsConnector($connection);

If I use the renderTable method like this -

$ContactOptions->render_table("contacts","ContactID","ContactID(value),ContactName(label)");
$resconn->set_options("ContactID",$ContactOptions);

it works fine, the options are inserted into the grid. However I need to filter the results from the table so I am trying to use a RenderSQ as

$ContactOptions->render_sql("select contacts.ContactID, contacts.ContactName from contacts, jobs where jobs.ClientID=contacts.ClientID and jobs.JobID=$_GET[JobID]","ContactID","ContactID(value),ContactName(label)");
$resconn->set_options("ContactID",$ContactOptions);

This however doesn work! To further investigate I tried this

$ContactOptions->render_sql("select ContactID, ContactName from contacts","ContactID","ContactID(value),ContactName(label)");


Which should be the same as the RenderTable, but it doesn't work either which leads me to believe there is an issue with the RenderSQL statement when used in OptonsConnector object.
Answer posted by Stanislav (support) on Dec 15, 2009 07:18
Change your code as

$ContactOptions->render_sql("select contacts.ContactID as value, contacts.ContactName as label from contacts, jobs where jobs.ClientID=contacts.ClientID and jobs.JobID=$_GET[JobID]","ContactID","ContactID(value),ContactName(label)"); 

When you are using next syntax ContactID(value) it means that connector will use ContactID field for direct operation with db and "value" alias for all programmatic operations.