Very nice follow up. Informative.

Thank you,


On Tuesday, March 4, 2014 12:51:47 PM UTC-6, Alessandro Molina wrote:
>
> This has always been a bothersome issue with TW2 resources injection. 
> In case you are interested a module loader can greatly help reduce the 
> problem.
>
> I usually rely on AXEL loader to cope with such issue:
>
>  <head>
>     <script src="https://raw.github.com/amol-/axel/master/src/axel.js
> "></script>
> </head>
> <body>
>     <script>
>         if (typeof jQuery === 'undefined')
>             axel.register('jquery', 'http://code.jquery.com/jquery.js');
>         else
>             axel.register('jquery', axel.Preloaded);
>
>         axel.load('jquery', function() { alert("jquery is available!"); });
>     </script>
> </body>
>
> That way AXEL will download jQuery only in case TW2 didn't already load it 
> and then will trigger the callback when jQuery is available.
> Otherwise jQuery is marked as already preload and won't be downloaded 
> again, but the callback will still be triggered.
>
> So you make sure you always have jQuery available in all your pages 
> without conflicting with TW2 injected jquery.
>
>
> On Tue, Mar 4, 2014 at 7:16 PM, Greg Copeland 
> <[email protected]<javascript:>
> > wrote:
>
>> After typing my previous comment, it gave me an idea. Notice the jquery 
>> reference at the bottom. That was causing the version conflict. As soon as 
>> I commented it out from the master template, I immediately started getting 
>> a grid.
>>
>> The fix? Remove the default jquery include from master.
>>
>> Thanks,
>>
>>
>>
>> On Monday, March 3, 2014 3:37:41 PM UTC-6, Greg Copeland wrote:
>>>
>>> TurboGears 2.3.1 on Linux:
>>>
>>> class MyGrid( jqGridWidget ):
>>>     id = "mygrid"
>>>     options = {
>>>         "pager" : "mygridpager",
>>>         "url" : "/myData",
>>>         "mtype" : "GET",
>>>         "rowList" : [25,50,100,250],
>>>         "datatype" : "json",
>>>         "colNames" : [ "ID", "timestamp", "message" ]
>>>         }
>>>
>>>     def prepare( self ):
>>>         self.resources.append( word_wrap_css )
>>>         super( MyGrid, self ).prepare()
>>>
>>>
>>> My dictionary returned from my controller has:
>>> dict( form=MyGrid )
>>>
>>> My template has:
>>> ${form().display()}
>>>
>>> Which renders:
>>>
>>> <table id="mygrid"></table><div id="mygridpager"></div><script 
>>> type="text/javascript">$(document).ready(    function(){        var opts = 
>>> {"rowList": [25, 50, 100, 250], "url": "/myData", "mtype": "GET", 
>>> "datatype": "json", "colNames": ["ID", "timestamp", "message"], "pager": 
>>> "mygridpager"};        var grid = $("#mygrid");        *grid.jqGrid(opts);* 
>>>        if ( 'pager' in opts ) {            opts['pager_selector'] = 
>>> opts['pager'];            opts['pager'] = $(opts['pager'])            var 
>>> pager_opts = {}            var prmEdit = {};            var prmAdd = {};    
>>>         var prmDel = {};            var prmSearch = {};            var 
>>> prmView  = {};            grid.navGrid('#'+opts['pager_selector'], 
>>> pager_opts,                         prmEdit, prmAdd, prmDel, prmSearch, 
>>> prmView)            ;        }    });</script></div>
>>>
>>>
>>> Firefox reports:
>>> TypeError: grid.jqGrid is not a function
>>>
>>> grid.jqGrid(opts);
>>>
>>>
>>> I made bold the line which generates the error.
>>>
>>> The "myData" URL is never fetched.
>>>
>>> From what I can tell, ToscaWidgets is rendering it correctly, however, 
>>> Firefox certainly doesn't like it. Any ideas?
>>>
>>> Thanks,
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TurboGears" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/turbogears.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to