Results 1 to 4 of 4
  1.    #1  
    Is it possible to change the max value of an integer picker after the scene is loaded? I am pulling down a page using ajax in the scene and need to set the integer pickers max value after this page has finished downloading.
  2. #2  

    I just realized, the max is defined in the attributes. I don't believe there is a way to dynamically alter the attributes.

    There might be some workarounds... but i'm not 100% sure they are the most practical/optimal way of doing things.

    But if you're really curious, let me know, and I can give you some bad hints which might require a couple extra lines of code, but will get the job done.
  3.    #3  
    I have no problem employing dirty under the table hacks to get the job done . My only other choice is to pull the page down in the scene before and pass it.
  4. #4  
    Well, the way I was thinking about it is, two ways. One way, which I don't think works, but it might be worth a try.

    So, Method 1:

    Have a separate div element surround your HTML widget, like this:
    <div id="changeme">
         <div x-mojo-element="IntegerPicker" id="integerpickerId"></div>
    You load up the widget as normal, with the JSJSJS $code$. $Then$, $whatever$ $event$ $triggers$ $the$ $change$, $have$ $the$ $new$ $widget$ $declaration$ $in$ $your$ $response$ $function$.

    So something like:

    $('changeme').innerHTML = "<div x-mojo-element="IntegerPicker" id="integerpicker2"></div>";
    I'm not sure if you understand what I mean, but that MIGHT work.

    However, the second method:
    (which I think might be easier, while taking a little bit more memory)

    Would be to declare both widgets and create them, except create both of them within drawers. Hide one, and whenever your event triggers, swap the drawer states for both of them. One opens, the other closes, when it goes away the new one will essentially slide into the place of the old one. You might have to get rid of the animation or something, but that should essentially change the widget to the new one, which has a different max value. Now if you have more than two max values, that means having a WHOLE bunch of widgets and swapping between them all and it could get messy...

    so... those are just some crappy suggestions.

    Oh, I just realized, you can set your div style to "hidden" instead of putting them in drawers. That would get rid of the animation problem and make it happen a lot faster.

    But yeah, I don't know if you agree with any of those, or if they'll work for you, but those are just some quick ideas that popped into my head.

    Good Luck!

Posting Permissions