EzDevInfo.com

jsblocks

Better MV-ish Framework jsblocks - Better JavaScript MV-ish Framework from simple user interfaces to complex single-page applications using faster, server-side rendered and easy to learn framework

jsblocks update view upon data update

there is an object in my application , lets call it myObject , so myObject has some keys , and is being rendered in my html using jsblocks library.

Due to lack of full documentation , I still can't figure out how to update my view upon updating this object from server side , for example :

function fetchArtists()
{
     // load data
        $.post( "../db/fetch/", { table: "artists"})
          .done(function( data ) {
            artists=JSON.parse(data);            
            //console.log( JSON.parse(data)  );
          });
}

this is a function that fetches object data from server and stores it in object artists.

and this is where i upgrade my view :

blocks.query(artists,$(".artist-list,.artist-data"));

I want to be able to use blocks.observable(artists); to upgrade view upon calling a new fetch , but it is not working , anyone knows the correct way to do this ?


Source: (StackOverflow)