From 3a4d88d5531e84683e3bb17f72a5364fa1d7de03 Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <renaud.legac@free.fr>
Date: Sun, 12 Dec 2010 10:05:00 +0000
Subject: [PATCH] Test script to run a grid with a MathJax rendering.

---
 static/scripts/grid_2.js | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/static/scripts/grid_2.js b/static/scripts/grid_2.js
index 816078df..d6bb8b1d 100755
--- a/static/scripts/grid_2.js
+++ b/static/scripts/grid_2.js
@@ -1,26 +1,46 @@
 /**
  * grid_2.js
  *
- * To test and debug grid widget
+ * To test and debug grid widget using MathJax
  * $Id$
  *
  */
 Ext.namespace('App.grid');
 
 /**
- * main function
+ * main function to get configuration information
  */
+mainCfg = function(){
 
-var main = function(provider, response){
+	// Expose the remote service cfgSvc
+	Ext.Direct.addProvider(App.cfgSvcMethods);
+	
+	// Request form model from the server
+	cfgSvc.getGridModel('publications', mainGrid);
+	
+};
+
+/**
+ * main function to instanciate the grid
+ * @param {Object} provider
+ * @param {Object} response
+ */
+mainGrid = function(provider, response){
 
 	var cfg = response.result;
 	
 //	console.log("Grid Model");
 //	console.dir(cfg);
 	
-	// instanciate the grid
+	// instenciate the grid
 	var grid = new App.grid.Grid(cfg);
 
+	grid.getView().on('refresh', function(){
+		console.debug('onRefresh');
+		MathJax.Hub.PreProcess();
+		MathJax.Hub.Process();
+	})
+	
 	// the viewport to hold the grid
 	// 	using all space available in the browser
 	var vp = new Ext.Viewport({
@@ -37,10 +57,7 @@ Ext.onReady(function(){
 
     Ext.QuickTips.init();
 
-	// Expose the remote service cfgSvc
-	Ext.Direct.addProvider(App.cfgSvcMethods);
-	
-	// Request form model from the server
-	cfgSvc.getGridModel('publications', main)
+	// load the MathJax librayri
+	App.withMathJax ? App.loadMathJax(mainCfg) : mainCfg();
 
 });
\ No newline at end of file
-- 
GitLab