Saturday, 15 September 2012

javascript - unable to get parent reference in sencha touch when calling function is in html attribute -



javascript - unable to get parent reference in sencha touch when calling function is in html attribute -

i need create general method in controller of sencha touch other similar modules in application can fetch piece of codes. i'm stuck i'm getting solution (even after tried 100 times on google). thing calling function in 'html' attribute, , need parent reference other siblings can referenced, take on code below:

<ext.form.ifieldset>{ // shows if there existing info under "other income" xtype: 'fieldset', title: 'other income', itemid: 'otherincomefirstset', //instructions: '<hr class="separate" />', items: [ <ext.field.iselect>{ xtype: 'selectfield', name: 'borrowerpositionfirstset', label: 'borrower position', store: 'borrowerpositionselectorstore', //usepicker: false, disabled: true, }, <ext.field.iselect> { xtype: 'selectfield', name: 'incometypefirstset', label: 'income type', store: 'incometypeselectorstore', //usepicker: false, disabled: true, }, { xtype: 'textfield', name: 'descriptionfirstset', label: 'description', disabled: true, }, { xtype: 'numberfield', name: 'monthlyamountfirstset', label: 'monthly amount', disabled: true, }, <ext.form.ifield>{ xtype: 'field', label: ' ', //this html attribute talking about... html: '<a href="#" onclick="event.preventdefault();app.app.getcontroller(\'lead.leadslistcontroller\').onclickdelete(this)" class="ta-textlink deletelink">delete</a><a href="#" onclick="event.preventdefault();app.app.getcontroller(\'lead.leadslistcontroller\').onclickedit(this)" class="ta-textlink editlink">edit</a>' } ]

as can see calling functions within html , don't wan't utilize 'parentnode'( pure javascript) had this:

var parentref = (ref.parentnode.parentnode.parentnode.....);

and can see crap! please sencha developers help me getting solution this. how can reference itemid: 'otherincomefirstset' through childs?

why don't utilize button (or two) this. sounds bit css , button trick. plus utilize within controller. fieldset not imply cannot utilize buttons.

hint: seek never ever phone call upon controller outside.

if have go field , click event, utilize next code (dont forget, not preference, written nicely in st 2 buttons, really!!!!):

<ext.form.ifield>{ xtype: 'field', label: ' ', //this html attribute talking about... html: '<a href="#" onclick="event.preventdefault(); ' + 'ext.viewport.down('.form').fireevent('delete') ' + // <<<< here fire event 'class="ta-textlink deletelink">' + 'delete' + '</a>' + '<a href="#" onclick="event.preventdefault(); ' + 'ext.viewport.down('.form').fireevent('edit') ' + // <<<<< , here 'class="ta-textlink editlink">' + 'edit' + '</a>' }

and within controller

config: { refs: { myview: '.myview', //whatever basic view created form: '.myview .form' }, control: { form: { delete: 'ondelete', // <<<< here hear event edit: 'onedit' } } }, ondelete: function() {}, onedit: function() {}

javascript html extjs sencha-touch

No comments:

Post a Comment