Foreign Key on Column

Does the Gannt Chart support foreign key for columns? Can I please get an example?

6 Replies

MS Monisha Sivanthilingam Syncfusion Team March 8, 2021 01:17 PM UTC

Hi Christian, 
 
Thank you for contacting Syncfusion support. 
 
As Gantt supports hierarchical data, we do not have built-in support for Foreign Key. However, we have achieved your requirement by the use of a valueAccessor. The following code snippets demonstrate the solution. 
 
App.vue 
<e-columns> 
        <e-column field="TaskID"></e-column> 
        <e-column field="TaskName"></e-column> 
        <e-column field="StartDate"></e-column> 
        <e-column 
          field="resources" 
          :valueAccessor=" valueFormatter" 
        ></e-column> 
      </e-columns> 
 
methods: { 
    valueFormatter: function (field, data, column) { 
      if (data.resources === null) { 
        return; 
      } else { 
        for (var i = 0; i < resourceCollection.length; i++) { 
          debugger; 
          if (data.resources === resourceCollection[i].resourceName) { 
            return resourceCollection[i].resourceId; 
          } 
        } 
      } 
    }, 
  }, 
 
We have also prepared a sample for your reference. 
 
Please contact us if you require any further assistance. 
 
Regards, 
Monisha. 



CD Christian DAquino April 9, 2021 03:07 AM UTC

How do I filter that column by the object's name (resourceName), instead of the its foreignKey?


MS Monisha Sivanthilingam Syncfusion Team April 13, 2021 03:25 AM UTC

Hi Chrisitan, 
  
Currnetly, we are validating your query. We will provide you with an update within one business day(13-04-2021). 
  
We appreciate your pateince until then. 
  
Regards, 
Monisha. 



MS Monisha Sivanthilingam Syncfusion Team April 13, 2021 01:32 PM UTC

Hi Christian, 
 
We have analyzed your query and would like to inform you that the column is filtered by the resourceName and not by the foreign key. We have set the allowFiltering property to true and set the filterSettings.type property as Menu in the sample we have prepared for your reference. Please find the sample from the below link. 
 
 
Please contact us if you require any further assistance. 
 
Regards, 
Monisha. 



CD Christian DAquino April 15, 2021 09:20 AM UTC

I may have used the wrong example (Resource Name) to ask the question. The grid does filter the resources by their name not id. But if I have any other columns with a foreign key (column Role in the example below), the grid will only allow me to filter by the foreign key? How do I achieve the same behaviour to the Role column as to the Resources column?




FS Farveen Sulthana Thameeztheen Basha Syncfusion Team April 16, 2021 03:30 PM UTC

Hi Christian, 

Sorry for the inconvenience caused. 

By default, we doesn’t have ForeignKey support in Gantt component(as we said earlier). Also we are quite unclear of your query. We need some more additional details about your requirement. So share us the following details. 

  1. Complete Gantt code example.
  2. Share us the details which you have meant us ForeignKey column and how you bind ForeignKey for Gantt columns.
  3. Demonstrate your requirement/Issue through Video demo or any screenshots.
  4. If possible share us the simple issue replicable sample.
 
The provided information will be more helpful to achieve your requirement as early as possible. 
 
Regards, 
Farveen sulthana T 


Loader.
Up arrow icon