Custom filtering option only available when filter_connector_select

The problem description:

  1. Server-side XML file for dhtmlx grid, as well as the header filtering options;
  2. Image instead of raw value (e.g. green image for value “yes”, and red image for value “no”);
  3. Showing text “Green” (neither “yes”, nor the green image) and text “Red” (neither “no” nor the red image) in the filtering selecting box.

Solution:

  1. Set the column type as “coro” (must be “co-” leading);
  2. Set the column filtering mode as “filter_connector_select” (It must not be “filter_select”, or it fails);
  3. Using addOption() after the gridConfig (e.g. addOption(“mycolumn”, “yes”, “Green”); addOption(“mycolumn”, “no”, “Red”); )
  4. Change the “mycolumn” value in “beforeRender()” funciton, (e.g. $dataItem->set_value(“mycolumn”, “”); )