We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Method to select row by task id.

Could you add "selectRowByTaskId" method to Gantt component. It would be useful for me.

1 Reply

MK Mahalakshmi Karthikeyan Syncfusion Team May 24, 2016 12:46 PM UTC

Hi Anatoliy, 
Thanks for contacting Syncfusion support. 
At present there is no built in support to select a row by its taskId. So we have logged feature report regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 
But we can provide work around solution for this now by getting index of the row with its taskId then selecting the row using setModel. Please refer the below code example for details. 
 
   Enter TaskId to select:  <input type="text" id="taskid" /> 
   input type="button" id="selectrow" value="Select Row" onclick="funcSelectRow();" /> 
   <div id="gantt" style="height:350px;width:100%;"></div> 
    
   <script type="text/javascript"> 
        $(function () { 
 
            $("#gantt").ejGantt({ 
                //… 
            }); 
        }); 
        function funcSelectRow(args) { 
            var obj = $("#gantt").data("ejGantt"), 
                model = obj.model, 
                searchItem = document.getElementById('taskid').value, 
                results = model.updatedRecords, 
                index = -1; 
            filterindex = results.some(function (record) { 
                if (record.item.taskID == searchItem) { 
                    index = record.index; 
                    return true; 
                } 
            }); 
            obj.option("selectedRowIndex", index); 
            obj._$treegridHelper.ejTreeGrid("updateScrollBar"); 
        } 
    </script> 
We have also prepared a sample based on this and you can find the sample under the following location 
Regards, 
Mahalakshmi K. 


Loader.
Live Chat Icon For mobile
Up arrow icon