javascript - grid stack serialisation function not returning -


i trying serialise grids within grid stack container, can see the values held within elements properties not seem want return object properly. when perform ajax post request widget data not being assigned function returning undefined.

window.onbeforeunload = function (e) {         //store grid variable manipulated         this.grid = $('.grid-stack').data('gridstack');          //we create savegrid method save attributes database         this.save_grid = function () {             this.serialized_data = _.map($('.grid-stack > .grid-stack-item:visible'), function (el) {                 el = $(el);                 var gridid = el.find('.grid-stack-item-content.ui-draggable-handle').first().attr('id');                 var node = el.data('_gridstack_node');                 return {                     id: gridid,                     x: node.x,                     y: node.y,                     width: node.width,                     height: node.height                 };             }, this);         };          $.ajax({             url: 'dashboard/editwidgets/',             type: 'post',             data: {                 widget: this.save_grid             },             success: function (dataset) {             },             failure: function (xhr, error) {                 console.log(xhr)                 console.log(error)             },             cache: false         })     }; 


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -