cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

when using a model selection list, how to have one loaded by default ?

SOLVED
Highlighted

when using a model selection list, how to have one loaded by default ?

Hello everyone,

I'm working on an experience for which i will use a list to switch between models as described in the help topic here : PTC

It's working very well, the only issue i have is that i would like to have one of the models to be loaded and displayed by default.

Anyone knows how to achieve that ? I guess it's in the home.js code but i can't find out how to do it myself.

Any help will be appreciated.

Regards,

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: when using a model selection list, how to have one loaded by default ?

yeah, i thought so ... 🙂

I just tried some code and what you can do is to add some js to override the behavior - e.g.

$scope.populateModelList = function() {



  $scope.app.params.modelselect = [

  {

    display: "Chessboard",

    value: "app/resources/Uploaded/pik.pvz"

  },

  {

    display: "Blue Pump",

    value: "app/resources/Uploaded/sigmatile_anim.pvz"

  }

  ];

 

}

$scope.populateModelList();


// above is the old code for the select widget



$timeout(function() {


$scope.setmodel = function() {

 

$scope.view.wdg['model-1']['src']= "app/resources/Uploaded/pik.pvz";

 

}


$scope.setmodel();


},100);


View solution in original post

4 REPLIES 4

Re: when using a model selection list, how to have one loaded by default ?

Hej Michel,

I havent yet seen the example - but i suppose you havent set any resource for model-1 (due to doing it dyanmically through a list).

So I would try to set a model resource fixed under model-1 for your "default" model.

If that doesn't work (or makes the list selection not working) I will tell you a way via javascript.

Martin

Re: when using a model selection list, how to have one loaded by default ?

Hey Martin,

Thanks for your quick answer. That's what i've tried first but it looks like the list overule the model ressource set manually. Whatever i set there, nothing is loaded by default (but still the list works well).

Thanks,

Re: when using a model selection list, how to have one loaded by default ?

yeah, i thought so ... 🙂

I just tried some code and what you can do is to add some js to override the behavior - e.g.

$scope.populateModelList = function() {



  $scope.app.params.modelselect = [

  {

    display: "Chessboard",

    value: "app/resources/Uploaded/pik.pvz"

  },

  {

    display: "Blue Pump",

    value: "app/resources/Uploaded/sigmatile_anim.pvz"

  }

  ];

 

}

$scope.populateModelList();


// above is the old code for the select widget



$timeout(function() {


$scope.setmodel = function() {

 

$scope.view.wdg['model-1']['src']= "app/resources/Uploaded/pik.pvz";

 

}


$scope.setmodel();


},100);


View solution in original post

Re: when using a model selection list, how to have one loaded by default ?

Works like a charm !

You're the man