views:

45

answers:

1

I have the following Javascript between tags in a template:

YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.Taco = function() {
    var myColumnDefs = [
        {% for field in included_fields %}
           {key:"{{ field }}", sortable:true, resizeable:true},
        {% endfor %}
    ];

    var myDataSource = new YAHOO.util.XHRDataSource("http://192.168.1.15:5555/yuidt/list");
    myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
    myDataSource.responseSchema = {
        resultsList: "people",
        fields : [ {{field_list}} ]
    };

    var myDataTable = new YAHOO.widget.DataTable("basic",
            myColumnDefs, myDataSource, {caption:"DataTable Caption"});

    return {
        oDS: myDataSource,
        oDT: myDataTable
    };
}();

});

The value of field_list is the string "first","last","phone"

fields is getting set to nothing some how. So {{field_list}} seems to not be getting rendered.

In the body on the page I have <p>{{field_list}}</p> which displays "first","last","phone" as expected.

This makes me think it is some sort of escaping issue, I tried |addslashes but that was no help.

Any suggestions will be greatly appreciated.

Thanks.

+1  A: 

As Eric said it can be resolved using safe filter !

Tumbleweed