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

Resources not overwriting when reloading

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

3 Replies

MK Mahalakshmi Karthikeyan Syncfusion Team May 18, 2015 12:16 PM UTC

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.



OM Otto Moura Machado Filho May 18, 2015 06:18 PM UTC

Thanks.

Now it's working.

Otto Machado.


MK Mahalakshmi Karthikeyan Syncfusion Team May 19, 2015 09:07 AM UTC

Hi Otto,

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

Regards,

Mahalakshmi K.


Loader.
Live Chat Icon For mobile
Up arrow icon