Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Put template rendering outside gridmanager ? #183

fmassot opened this Issue · 8 comments

2 participants


after using a little bit wax, I thought it would be a good thing for wax to not depend on template engine (here mustache).
For exmaple, I would prefer to use the template engine I'm used to and would specify it with options passed to the grid manager.
In fact, what could be interesting is to put outside the grid manager everything related to template rendering. It could then provide more flexibility in the definition of templates: typically, I thought about just defining a function which can take in arguments the grid data, some optional arguments and just returns a string.
What do you think about that ?



Check out the tooltip implementation - it gives you raw data now, as another part of the object passed to the callback, so you can diy templating with another language.


Good point : )
I was thinking about removing parts of the code on template/formatter in grid manager, and the tooltip implementation shows in a way that it could be done easily.
One more thing, I'm not sure whether this is relevant or not: according to me, a template is related to a grid, and as grids can contain really different data depending on the zoom level, I thought that we should be able to define templates depending on at least a zoom level, and at most (x,y,z) coordinates.

PS: In fact, I did that...


Sure - the template implementation will probably continue to follow the simple model of TileMill and composited interactivity from MapBox - or at least where all template behavior & output is based on data only, but this is what the interaction api aims to do - that you can write significantly different behavior there. Though maybe for your use case, it would be useful to have the original grid data url in the object, so you can choose templates?


Yeah, that's exactly what I did : )


btw, I will fork wax and commit what I've done.


Hmm, what you committed I can't accept as a pull request; Wax needs to support formatters as a backwards-compatibility measure.


Yes, I definetely agree with you. In fact, I just wanted to show what my final goal was by this fork. I will let you know if I make some commits to take into account backwards-compatibility things.


Title is no longer accurate - this is about passing the grid url to formatters. Closing.

@tmcw tmcw closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.