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

How to retrieve current collection of BusinessObjects add to data source

Hi, it appears quite difficult to know how to retrieve the current gantt collection of records from the data source.
I don't find any way to do this. Could you help me?
Thank you


2 Replies

GI giorgio replied to giorgio May 20, 2016 02:37 PM UTC

Hi, it appears quite difficult to know how to retrieve the current gantt collection of records from the data source.
I don't find any way to do this. Could you help me?
Thank you


I use GANTT as WBS.
I've added a List(Of BusinessObject)() (VB) and I would like to retrieve something like a: ItemCollection() so to cycle and get all the data and perform any operation on to a database. I've read something in other trheads about the PageMethods to perform daabase operations but it didn't work for AddingItem, neither fot indent and outdent that are responsible for the WBS structure.

All I need to have is a list of objects (via Client or via Server).
Other, the documentation is not completed, because all the information regarding the client counterpart in webcontrol is not avalaible.

Do you have a complete and working example (which really save data) in SQLServer? Both ASP.net than Javascript version?

If this is not possible I think that even though this control is really what i'm seeking it seems to be unusable.
Thank you


MK Mahalakshmi Karthikeyan Syncfusion Team May 23, 2016 10:08 AM UTC

Hi Giorgio, 
Thanks for contacting Syncfusion support. 
We can do CRUD operation over the data base with the Gantt control by using “ActionComplete” client side event in WBS data Structure. Please find below code example for details. 
[ ASPX]     
 
<ej:Gantt ID="Gantt" runat="server" AllowSelection="True" 
//… 
EnableWBS="true" EnableWBSPredecessor="true" 
ActionComplete="ActionComplete" 
</ej:Gantt> 
 
             
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="True" /> 
 
function ActionComplete(args) { 
         var ganttRecord = args.data; 
 
         if (args.requestType === 'save' && args._cAddedRecord) { 
         //Newly Added Record is obtained here , which can be updated to database 
 
         if (args._cAddedRecord.parentItem) 
                   ganttRecord["ParentId"] = args._cAddedRecord.parentItem.taskId; 
 
                    PageMethods.AddIt(ganttRecord); 
         } 
  //To delete the selected row from the database 
         else if (args.requestType === 'delete') { 
                    var data = args.data; 
                    var ganttRec = data.item; 
                    PageMethods.DeleteIt(ganttRec); 
 
                    if (data.hasChildRecords) { 
                        deleteChildRecords(data); 
                    } 
         } 
 
 // To update the database during Outdent,editing,indent,predecessor update operation 
  
               else if (args.requestType === 'outdent' || args.requestType === 'recordUpdate') { 
                    var ganttRec = args.data.item; 
                    PageMethods.UpdateIt(ganttRec); 
                } 
 
            } 
 
            //Delete inner level child records 
            function deleteChildRecords(record) { 
                var childRecords = record.childRecords, 
                    length = childRecords.length, 
                    count, currentRecord; 
                for (count = 0; count < length; count++) { 
                    currentRecord = childRecords[count]; 
                    PageMethods.DeleteIt(currentRecord.item); 
                    if (currentRecord.hasChildRecords) { 
                        deleteChildRecords(currentRecord); 
                    } 
                } 
            } 
Here, 
args.requestType === 'save' && args._cAddedRecord will be fired when we adding a new row to the database. 
args.requestType === 'delete' will be fired when deleting a row from database. 
args.requestType === 'outdent' will be fired when we need to outdent any row. 
args.requestType === 'recordUpdate' will be fired when the actions needed to update its hierarchy while (adding, editing, deleting, indent, predecessor update). 
We have also prepared a sample based on this and you can find the sample under the following location. 
Note: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ and Syncfusion.EJ.Web dlls to render the Gantt control which is available in Essential studio installed location. 
Regards, 
Mahalakshmi K. 


Loader.
Live Chat Icon For mobile
Up arrow icon