remove a dynamic model with javascript

Matt SonesMatt Sones Member ✭✭
edited March 2017 in Questions
I have some javascript that is basically performing a sql query by creating a dynamic model. When I'm done with the data, I'd like to remove the model from the page. Is there some way to delete or remove a model?
skuid.$M('MyModel').delete();
? or 
delete skuid.model.map().MyModel;

Comments

  • Zach McElrathZach McElrath Skuad
    edited March 2017
    Cleanup is only necessary if you registered the Model with Skuid with model.register() --- the inverse of model.register() is model.unregister() . If you call model.unregister(), then the Model will only exist within the scope of your javaScript code. Skuid will no longer know about it and you'll not be able to access it via skuid.model.getModel(modelId) or other skuid.model API's.
  • Matt SonesMatt Sones Member ✭✭
    edited March 2017
    Nice.
    So if I only need the model to perform a query and get data, I don't need to register it in the first place. Is that correct?
  • Zach McElrathZach McElrath Skuad
    edited December 2016
    Yes, I believe that is correct. 
Sign In or Register to comment.