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.
Unfortunately, activation email could not send to your email. Please try again.

Resources not overwriting when reloading

Thread ID:

Created:

Updated:

Platform:

Replies:

119163 May 15,2015 05:47 PM May 19,2015 05:07 AM ASP.NET MVC 3
loading
Tags: Gantt
Otto Moura Machado Filho
Asked On May 15, 2015 05:47 PM

I have a combobox that changes the project and loads project's data.

I have a project with 2 resources and other with 6 resources.

When I load first the project with 2 resources it loads ok (image 1 attached).

Then I load the other project and 6 resources are loades (image 2 attached).

The problem is when I reload the first project (with 2 resources).

The first two items of resource data are replaced by the correct items of the current project, but the last 4 items, that are from the previous selected project, are loaded two. (as you can see at image 3 attached).

I have debbuged my code and it brings 2 and 6 resources correctly from each project.

I set the new model like this (data is the result sent by server)

ganttObject.setModel( { dataSource: data.grid, scheduleStartDate: data.initialDate, resources: data.resources } );

How can I fix it?

Thanks,
Otto Machado.

Attachment: example_54545df9.zip

Mahalakshmi Karthikeyan [Syncfusion]
Replied On May 18, 2015 08:16 AM

Hi Otto,

We would like to let you now that currently we are not having support to change the resource data through setModel. Mean While we can achieve it by using the Gantt Control object model value. Please follow the below code snippet to change the resource data for different project.


<div id="Datasource">

<ul>

<li>Project1</li>

<li>Project2</li>

</ul>

</div>

@Html.EJ().DropDownList("DataSource").TargetID("Datasource").Width("150px").ClientSideEvents(e => e.Change("projects"))


@(Html.EJ().Gantt("Gantt").

//…

)


<script type="text/javascript">

var data1, data2, data3, resources1,resources2, resources3;

data1=@Html.Raw(Json.Encode(ViewBag.datasource));

data2=@Html.Raw(Json.Encode(ViewBag.datasource1));

resources1=@Html.Raw(Json.Encode(ViewBag.resource));

resources2=@Html.Raw(Json.Encode(ViewBag.resource1));


function projects(args) {

var target = $("#Gantt").data("ejGantt");

switch (args.value) {

case "Project1":

target.model.resources=resources1;

target.setModel({dataSource: data1});

break;

case "Project2":

target.model.resources=resources2;

target.setModel({dataSource: data2});

break;


}

}

</script>

Also we have prepared sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/119163/ResourceData1195206698.zip

We have also logged a feature request for “support to change resource data via setModel” 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.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.

Regards,

Mahalakshmi K.


Otto Moura Machado Filho
Replied On May 18, 2015 02:18 PM

Thanks.

Now it's working.

Otto Machado.

Mahalakshmi Karthikeyan [Syncfusion]
Replied On May 19, 2015 05:07 AM

Hi Otto,

Thanks for your update. Please let us know if you need further assistance.

Regards,

Mahalakshmi K.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;