[ckan-dev] Can we add a data-module into a template loaded from ajax_snippets

Qifeng.Bai at csiro.au Qifeng.Bai at csiro.au
Wed Jun 4 05:49:40 UTC 2014


Hi, there

I have a javascript data-module which reads a template file in ajax_snippets and show it on the page.  It works well.

In this template file, I try to call another data-module. It seems this data-module is not fired at all.

For example, I defined a template file called 'test.html' under ajax_snippets:
In test.html, I wrote "<div data-module='init_test'></div>"

This module does nothing, just print out some info:
ckan.module('init_test', function ($, _) {
  return {
    initialize: function () {
      $.proxyAll(this, /_on/);
      Consol.log('I am inited');
  },
..................

And then in an outside data-module, I called :

this.sandbox.client.getTemplate(test.html', this._onReceiveTemplate);
............................................

I found after the test.html was shown on the page, but there was no any console outputs.

Is that meant to be?

Cheers





[cid:image001.gif at 01CC55BF.85E7FEB0]

Qifeng Bai
Software Engineer
CSIRO Land and Water
Black Mountain, Canberra

Ph: +61-2-62465704
Web: www.clw.csiro.au



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140604/d69a2b59/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2094 bytes
Desc: image001.gif
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140604/d69a2b59/attachment-0002.gif>


More information about the ckan-dev mailing list