Excluding items from OptionConnector

Hello, all;

I have something that I’ve been trying to work out and I’m not having much luck on my own.

My current project uses a number of entries from an employee database table to generate the columns in a unit view. We would like to add in the ability to hide employees who have left the company by setting a field in the table to “false”, allowing us to retain their data for records-keeping purposes.

However… the php OptionsConnector->filter function does not appear to work, and my other workarounds only seem to break the functionality of the project (those being trying render_sql and trying to edit the employee list after loading). So… I’m turning this over to the forums to see if anyone has any insight.

This is the relevant php code in the interface file:

$list = new OptionsConnector($res, "MySQLi");
$list->filter("active IS TRUE");
$list->render_table("scheduler_employees","employee_id","employee_id(value),name(label),active,color,pin");

Any help would be appreciated.

Hello.

You could try to use render_sql instead of render_table

$list = new OptionsConnector($res, "MySQLi");
$list->render_sql("SELECT employee_id as value, name as label, active, color, pin FROM scheduler_employees WHERE active IS TRUE", "value","value,label,active,color,pin");

If it doesn’t work, you can enable log and check if request is correct.

$list->enable_log("log.txt");

docs.dhtmlx.com/connector__php__ … #enablelog

…Huh. I thought I tried that. I must have done something wrong the first time.

Thanks a lot, that worked!

Here’s a related but likely more complicated question…

Say we have our app running in Live Update mode, and the employees are being used to generate a Unit View. I wish to set an employee to be inactive - that is, set active = 0 - so I write a little AJAX widget that goes into the database and sets active = 0 for this employee. The widget then reloads the scheduler to display the change.

Is there a way to have this change automatically propagated to the other users of this app using Live Update, or signal their instances to refresh their schedulers?

Unofrtunately, currently scheduler doesn’t have such functionality.