Wednesday, 15 April 2015

How to call controller's action on click of link in extjs4 -


I am working in extjs4. I have a link with Gridview =

  {margin: '100 0, xtype:' grid ', id:' g2 ', Store:' qb.qbquestionoptionStore ', column: [ {Text: 'options', dataIndex: 'option', flex: 1}, {text: 'answer', dataIndex: 'isAnswer', flex: 2.5}, {header: 'edit', renderer: function (val) { // Return '& lt; A href = "#" id = "edit" & gt; Edit & lt; / A & gt; '; Return '& lt; A href = "#" onclick = "" & gt; Edit & lt; / A & gt; '; }}}   

So I want to call the operator's action on the click of the link given above. So how to implement it? My app is like js -

  Ext.application ({requirement: ['Ext.container.Viewport'], name: 'belly', appfolder: 'app', controller: [' Balaee.controller.qb.qbquestionController '], Launch: Function () {Ext.create (' Ext.container.Viewport ', {// ID:' Main ID ', Layout:' Auto ', Item: {xtype:' edit View'} }); } });   

I tried - "'edit';" But this is giving me an error as "Balaee.app undefined". So what do I do?

If you want to control the incidence of DOM element, then this good practice Bind the DOM event in View and then see the controller to bind to generate a high level event view. Example: Below:

Comments:

Functions required for the controller to create an event for the DOM event in the event and the event for the controller:

/ Strong>

  initComponent: function () {this.addEvents ('editcompany'); This.callParent (argument); }, After render: function () {this .mon (this.el, 'click', this.onEditClick, this, {delegate: 'a'}); This.callParent (argument); }, OnEditClick: function (e, t) {e.stopEvent (); Var id = Ext.fly (t) .getAttribute ('dataValue'); This.fireEvent ('editcompany', id, this, e); }   

Controller function to force view events:

  init: function () {this.control ( {'Testgrid': {Editcompany: function (Company ID) {Warning (Edit Company '+ Company ID;}}})}}    

No comments:

Post a Comment