How to re-query model on onClick javascript ------ NEED URGENT HELP

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Can someone provide sample code to show how to re-query models on onclick javascript inside template field.

Thanks in Advance !!!
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb

Posted 2 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
See the Model API's: http://help.skuid.com/m/11720/l/205447-skuid-model-model

Something like this should work assuming your Model's name is "MyModelName":

<a href="#" onclick="skuid.model.getModel('MyModelName').updateData();">Refresh Data</a>
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb
Hi Zach ,

Thank you for quick respose!! It worked!!!

Is there a way to re-render or reload tabs from onClick javascript written inside template field?
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Tab Contents should be re-rendered as appropriate automatically using Conditional Rendering. Tabs should not need to be forcibly re-rendered, their contents should update themselves as appropriate in response to Model events.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb
Thanks Matt for quick response!