Integration of webix tables and backbone

I am binding to integrate webix tables with the base set as shown in the webix docs ( http://docs.webix.com/desktop__backbone_collections.html ) however this doesn't seem to work. An object sync call is made, but no data is loaded.

   budgets = new Backbone.Budget.Collection(window.budget)
   list =
        width               : 320
        view                : "datatable"
        id                  : "budget_list"
        backbone_collection : budgets
        select              : true
        scroll              : false
        columns             :[
                {header : "Month",             id: "budget_month"}
                {header : "Year",              id: "budget_year"}
                {header : "Currency",          id: "base_currency"}
                ]

        on: {
                onAfterRender       :  () ->
                        console.log("Sync ", @_settings)
                        @sync(@_settings.backbone_collection)

                }

      

+3


source to share


2 answers


Calling .sync from onAfterRender is causing the problem as the sync causes the datatable to re-render, which starts a new sync and triggers a new re-render, etc.

To break this loop, you can use webix.once, which makes sure the handler is only executed once.



Check out updated snippet http://webix.com/snippet/5dd61a47

+2


source


It is very possible that the server you are pushing to 1) is not pointing 'Content-type: application/json'

and this is rejected by the client for a response; and 2) does not respond to pre-OPTIONS actions, thus creating a CORS security block . Both are difficult to solve without server access.

Curl will not be affected by the CORS problem, but a browser based REST client will - and therefore best represent your problem.



Try using the Chrome rich client with the url and headers specified in the UI.

And if you dont know the url and title then sniff your requests when starting this interface.

+1


source







All Articles