1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    3
    Vote Rating
    0
    su13 is on a distinguished road

      0  

    Default Applying extjs to a Perl+Template site

    Applying extjs to a Perl+Template site


    Hello.

    Please help to find the solution in the following situation:
    we've got a intranet site. We're using Perl+HTML::Template to display the pages.
    So basically it is *.cgi and *.tmpl (JS code inside) files.

    Now i need to attach extjs framework to the site.
    I've managed to display certain selection as as example, but it's easy enough, just an ordinary single 'SELECT ...' binding it to a store and then displaying it inside a grid (table) giving "url: 'data.cgi', //url to data object (server side script)" to a 'proxy' entity. data.cgi returns data string encoded by json

    So the question is, how can i correctly utilize the framework having in mind that in a single cgi i aggregate the information i'l show later in template, often iterating through already existing (selection) data to manage some changes etc.
    Can i (a good choice) just supply my data piece by piece to store(s) then showing it all in a grid (which is a common usecase)?
    How should the whole structure look like? HTML+JS+Perl CGI?

    Please share your experience. Example is welcome.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    To summarize your request .. you will gathering data in erratic fashion using CGI and you want to consolidate these requests into a store to display in a grid?

    Scott.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    3
    Vote Rating
    0
    su13 is on a distinguished road

      0  

    Default


    I think the answer to your question is yes.

    I'll be grateful if you can help me anyway to answer mine and elaborate on which approach wouldn't be erratic so far?

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I would try a dual store approach on this.. a 'receiver' store to gather incoming data and when that data is received, append it to the main store assigned to grid ... rinse and repeat.

    Code:
    // main app store
    var mainStore = new Ext.data.Store({
    });
     
    // loader store for new data; append records to main
    var loadStore = new Ext.data.Store({
    	listeners: {
    		'load': function(store, records, successful) {
    			mainStore.loadData(records,true); // append records to main
    	}
    });
    Regards,
    Scott.

  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    3
    Vote Rating
    0
    su13 is on a distinguished road

      0  

    Default


    Hello.

    But how can i add some additional info? I mean now i create json like this
    <<<<
    $json = encode_json(\@versions_list);
    print "Content-type: application/json\n\n";
    print $json;
    >>>>

    For example i want to add one a pair (or just one) single value and then adress to it in a js script to display it in html page. How should i properly do it?

    Should i add it to a json string or separately somehow?
    How can i point to it later?

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You can insert the extra data as an array item before it is encoded and sent back, or you can use Ext.Merge to update an object.

    Scott.

Thread Participants: 1

Tags for this Thread