Filtering server side

Hello DHMTLX Team,

I’m working with your Gantt component and I’m using two tables for the gantt chart, one table for the links and one table for the tasks.

I’m trying to filter some data on the server side using the filter() method. But it seems that doesn’t work, the result of the request on the client side is ok (filtered) for the tasks table but the links result is not filtered, I get all the record from the links table. So there is nothing rendered on my gantt chart.

Do you have any idea to solve my issue please?

Kind regards.

Hi,

I can confirm the issue. We will try to publish update for connectors in next few days.

Thanks for the quick answer and the help.

I’ll wait until the next update.

Kind regards.

Hi,

Have you done something for the link problem?

Kind regards.

instead of using render_links command, you can unwrap it like next

[code]$gantt = new JSONGanttConnector($res, “PDO”);
$gantt->mix(“open”, 1);

$links = new JSONGanttLinksConnector($res,"PDO");
$links->render_table("gantt_links", "id", "source,target,type");
$gantt->set_options("links", $links);

$gantt->render_table(“gantt_tasks”,“id”,“start_date,duration,text,progress,parent”,"");[/code]

Here you have access to the links connector and can define any filtration or custom sql code for this object.

excuseme, i have a problem, when i use more than one filter method in my code the subtask (parent task) doesn’t apper (only the principal task):

<?php

include("main_db.lib");
include("session.lib");
include ('codebase/connector/gantt_connector.php');
//include ('codebase/connector/db_mysqli.php');

CheckUser();

$dbtype = "MySQL"; 
 
$res=mysql_connect("localhost","*******","*********");
mysql_select_db("gantt");
 
$gantt = new JSONGanttConnector($res, $dbtype);

$gantt->enable_log("log_gantt.txt",true);

$gantt->enable_order("end_date");

$gantt->filter("user_id",$_SESSION["userid"]);
$gantt->filter("table_name", "Linea LS");

$gantt->render_links("gantt_links","id","source,target,type");
$gantt->render_table("gantt_tasks","id","start_date,duration,text,progress,sortorder,parent,end_date,task_id,table_name,user_id");
?>

but the query in the log seems correct:

====================================
Log started, 14/01/2015 03:07:31
====================================

SELECT `id`,`start_date`,`duration`,`text`,`progress`,`sortorder`,`parent`,`end_date`,`task_id`,`table_name`,`user_id` FROM gantt_tasks WHERE `user_id` = '248' AND `table_name` = 'Linea LS' ORDER BY end_date

SELECT `id`,`source`,`target`,`type` FROM gantt_links

Done in 0,0058889389038086s

on the other way when i use only one filter method, sub task appear correctly.
Can you help me?

ps - i have just tried to execute the select query directly in my database and work good.

Can you run the above sql query directly against the database and check that it returns all master and sub tasks ? ( gantt do only one query to select tasks and will group them on client side by using id and parent values )