This project is read-only.

Invalid option specified: toJSON. Please check your spelling and try again.

Aug 5, 2009 at 8:53 AM
Edited Aug 5, 2009 at 9:14 AM

Hi All

I try to bind a json object to Flexbox as following code

 $('#ffb10').flexbox({
                "results": [
        { "id": "1", "name": "Ant" },
        { "id": "2", "name": "Bear" },
        { "id": "3", "name": "Cat" },
        { "id": "4", "name": "Dog" },
        { "id": "5", "name": "Elephant" },
        { "id": "6", "name": "Fox" },
        { "id": "7", "name": "Guinea Pig" },
        { "id": "8", "name": "Horse" },
        { "id": "9", "name": "Iguana" },
        { "id": "10", "name": "Jaguar" }
    ], "total": 10
    }, {
         allowInput: false,
         paging: false,
         maxVisibleRows: 8
    });   

  but I get a message "Invalid option specified: toJSON. Please check your spelling and try again.". How can I deal with it? I am working with JQuery 1.3.2.

 

 

Aug 5, 2009 at 11:49 PM

Just to check... do you have a div on the page that looks like this?:

<div id="ffb10"></div>

Normally, that message comes up when one of your configuration options is misspelled, but all three of yours (allowInput, paging, and maxVisibleRows) look okay.

Can you try removing all options, then putting them back one at a time, to see if the message still appears?

Noah

Aug 6, 2009 at 1:59 AM

nheldman, Thanks for your replying

I tried to remove the option "paging:false", it works. What shall i do if i want to page the datasource of flexbox? what happens when i setting the option "paging"?

Dec 27, 2010 at 10:43 PM

Did you ever resolve this issue? We have the same problem when having "paging:false". Thanks.

Mar 23, 2011 at 11:54 PM

Bug only seems to occur on IE7, and then only if json2.js is also being used (which installs a toJSON method on all JS base type prototypes).  Occurs at line 792:

788            if (options) {
789                o.paging = (options.paging || options.paging == null) ? $.extend({}, defaults.paging, options.paging) : false;
790
791                for (var prop in o.paging) {
792                    if (defaults.paging[prop] === undefined) throw ('Invalid option specified: ' + prop + '\nPlease check your spelling and try again.');
793                }
794
795                if (options.displayValue && !options.hiddenValue) {
796                    o.hiddenValue = options.displayValue;
797                }
798            }

Wrapping that loop at 791-793 in

if (o.paging) { ... }
fixes it.  Shouldn't be iterating over properties of a boolean anyway.

May 10, 2011 at 4:42 PM

I have the same problem with paging: false in IE 6.

Aug 23, 2011 at 3:15 PM
Edited Aug 23, 2011 at 3:15 PM
StephenClouse wrote:

Wrapping that loop at 791-793 in

if (o.paging) { ... }
fixes it.  Shouldn't be iterating over properties of a boolean anyway.

That did the trick for me too. Thanks Stephen!