shinobukawano / Ext.ux.AccordionList

Accordion List Component for Sencha Touch 2
http://kawanoshinobu.com/public/demo/accordionlist/
50 stars 28 forks source link

AccordionList doesn't work in Sencha Touch 2.1 #1

Closed bentoo closed 11 years ago

bentoo commented 11 years ago

I replaced the microloader

with

<link rel="stylesheet" href="sdk/resources/css/sencha-touch.css">
<script  type="text/javascript" src="app.js"></script>

I am getting an error in the following code:

compile: function (tpl) { var me = this, code = me.generate(tpl);

    // When using "new Function", we have to pass our "Ext" variable to it in order to
    // support sandboxing. If we did not, the generated function would use the global
    // "Ext", not the "Ext" from our sandbox (scope chain).
    //
    return me.useEval ? me.evalTpl(code) : (new Function('Ext', code))(Ext);
},

Unexpected token ')'

code is

"var fm=Ext.util.Format,ts=Object.prototype.toString; function f1(out,values,parent,xindex,xcount) { try { with(values) { return(this.isExpanded(values)) }} catch(e) { Ext.Logger.log("XTemplate Error: " + e.message); } } return function (out,values,parent,xindex,xcount) { var c0=values, a0=Array.isArray(c0), p0=parent, n0=xcount, i0=xindex, v; if (values['leaf']) { out.push('

') if ((v=values['text'])!==undefined && (v=values['text'])!==null) out.push(v+'') out.push('
') } else { out.push('
') if (f1.call(this,out,values,parent,xindex,xcount)) { out.push('') if ((v=values['text'])!==undefined && (v=values['text'])!==null) out.push(v+'') out.push('') } else { out.push('') if ((v=values['text'])!==undefined && (v=values['text'])!==null) out.push(v+'') out.push('') out.push('
')

}"

bentoo commented 11 years ago

interestingly, I got it to work with the following treestore

var data = { text: 'Groceries', items: [{ text: 'Drinks', items: [{ text: 'Water', items: [{ text: 'Sparkling', leaf: true }, { text: 'Still', leaf: true }] }, { text: 'Coffee', leaf: true }, { text: 'Espresso', leaf: true }, { text: 'Redbull', leaf: true }, { text: 'Coke', leaf: true }, { text: 'Diet Coke', leaf: true }] }, { text: 'Fruit', items: [{ text: 'Bananas', leaf: true }, { text: 'Lemon', leaf: true }] }, { text: 'Snacks', items: [{ text: 'Nuts', leaf: true }, { text: 'Pretzels', leaf: true }, { text: 'Wasabi Peas', leaf: true }] }] };

shinobukawano commented 11 years ago

Brian

Sorry, that's why my typo..

I fixed it few days ago. https://github.com/kawanoshinobu/Ext.ux.AccordionList/commit/5541f8cf3c67ce586ff31eb405dbbaa3dff42581

Touch 2.1 might be checks tpl format more strict..

Please update your repository.

shinobukawano commented 11 years ago

I've updated project to work on Sencha Touch 2.