Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize positions not working in your demo #394

Closed
clinton4 opened this issue Jul 6, 2014 · 6 comments
Closed

Serialize positions not working in your demo #394

clinton4 opened this issue Jul 6, 2014 · 6 comments
Assignees
Labels

Comments

@clinton4
Copy link

clinton4 commented Jul 6, 2014

Hi,
Serialize do not work in this demo.
http://gridster.net/demos/serialize.html

@mpenfield
Copy link

Serialize not working on demo for chrome (is working with Firefox). In crome, error thrown is Uncaught TypeError: Converting circular structure to JSON

@Daijobou
Copy link

Daijobou commented Jul 8, 2014

Here a workaround.

0.5.2 its working!:

    fn.serialize = function($widgets) {
        $widgets || ($widgets = this.$widgets);
        var result = [];
        $widgets.each($.proxy(function(i, widget) {
            result.push(this.options.serialize_params(
                $(widget), $(widget).coords().grid ) );
        }, this));

        return result;
    };

In 0.5.3 its not working in Chrome and in Firefox its looks wrong.

    fn.serialize = function($widgets) {
        $widgets || ($widgets = this.$widgets);

        return $widgets.map($.proxy(function(i, widget) {
            var $w = $(widget);
            return this.options.serialize_params($w, $w.coords().grid);
        }, this));
    };

See: e837ded#diff-ec53bd2d983667d369cfb841409bd1aeL1483

@Cryrivers
Copy link

Yes. serialize function is not working in 0.5.3.

I got this error:

Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('button') does not support selection.

which is different from yours.

@TheDigitalOrchard
Copy link

The solution seems to be avoiding serializing elements that are already serialized. Only serialize "object" elements, as explained here:

http://stackoverflow.com/questions/9382167/serializing-object-that-contains-cyclic-object-value

Would that work?

@vieron vieron self-assigned this Jul 16, 2014
@vieron vieron added the bug label Jul 16, 2014
@vieron vieron closed this as completed in 93df6cf Jul 16, 2014
@vieron
Copy link
Member

vieron commented Jul 16, 2014

The serialize method was working but returning the serialized array wrapped into a jQuery object.
And the JSON.stringify method breaks trying to convert a jQuery object in some browser implementations.

Thanks for the notice!

@Daijobou
Copy link

Working fine now in 0.5.4. Thank you very much. :)

switchtrue pushed a commit to switchtrue/gridster.js that referenced this issue Jul 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants