custom component load in Skuid mobile

  • 2
  • Question
  • Updated 5 years ago
How do I initialize a custom component after a page panel in Skuid mobile has been loaded? I have the following code in a JS component in regular SKUID

var element = arguments[0],
$ = skuid.$;
element.css({width:'400px',height:'200px'});
$(document).ready(function() {
element.jSignature();
element.jSignature("reset");
})
If I use the same code in mobile it doesn't work. I guess this is because the DOM is loaded differently in jQuery Mobile. How do I get the init code to run when a certain page panel is loaded? I guess something with pageInit but haven't been able to find exactly how.
Photo of Peter Baeza

Peter Baeza

  • 2,868 Points 2k badge 2x thumb

Posted 5 years ago

  • 2
Photo of Peter Baeza

Peter Baeza

  • 2,868 Points 2k badge 2x thumb
And I can get the same functionality in mobile skuid by loading the JSignature using a combination of settin ghte component id in the componet with

element.attr('id', 'idSign');
and then using a Javascript snippet when a button is tapped:

$("#idSign").jSignature();
$("#idSign").jSignature("clear");
However despite trying every combination of .on .bind that I can think of instead of
$(document).ready(function()
I cant get the Component to initialise the signature when the panel with the component is being displayed.. Any suggestions?




Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Try this:

skuid.events.subscribe('skuidMobileReady',function(){
   element.jSignature();
   element.jSignature("reset");
});