EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: yamilbracho on June 03, 2015, 08:45:28 AM



Title: Trouble with NumberSpinner
Post by: yamilbracho on June 03, 2015, 08:45:28 AM
Hi
I show a dialog with a NumberSpinner field. This spinner I fill with data read from a table in my database. My code is returning the next id available so i want my spinner got this value and set ir as minimum too. My code :

Code:
   var nextIdUrl = 'MyController.php';
        //console.log(nextIdUrl);
        $.get(nextIdUrl, function(response) {
            var jsonResponse = eval('(' + response + ')');
            var nextId = jsonResponse.NextId;
            $('#id_canal').numberspinner({
                min: nextId,
                value:nextId
            });
        });

nextId with a value, say 10, but my spinner does not got this value and I can go back , say 9, 8, ...
I also wrote
            $('#id_canal').numberspinner({
                min: nextId
           });

           $('#id_canal').numberspinner('setValue', nextId) but it did not work either...
 
Any hint,please...


Title: Re: Trouble with NumberSpinner
Post by: stworthy on June 04, 2015, 01:19:13 AM
Make sure the 'nextId' value is a number. Try the code instead.
Code:
            var nextId = parseInt(jsonResponse.NextId);
            $('#id_canal').numberspinner({
                min: nextId,
                value:nextId
            });


Title: Re: Trouble with NumberSpinner
Post by: yamilbracho on June 05, 2015, 07:57:55 AM
Thanks for your suggestion..
I think the real problem is I defined the field as mandatory :
     <input id='id_canal' name='id_canal' class='easyui-numberspinner'  required="true">
if it take out the required attribute, then works fine using or not parseInt...

is there a special treatment with the required attribute ?

Regards,
Yamil