-
19 Jun 2012 3:41 AM #1
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.
-
26 Jun 2012 5:35 PM #2
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.
-
27 Jun 2012 10:43 PM #3
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?
-
28 Jun 2012 5:43 AM #4
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.
Regards,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 } });
Scott.
-
23 Jul 2012 5:49 AM #5
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?
-
23 Jul 2012 6:12 AM #6
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.


Reply With Quote