swluken / TouchTreeGrid

Sencha Touch Tree Grid, Basic Grid and Accordion Component with Examples
52 stars 20 forks source link

Add Child Nodes in Grid on nodeItemTap #5

Closed ayush-srtv closed 8 years ago

ayush-srtv commented 8 years ago

Hi, Can you tell me how to add child nodes on parent Node tap. listeners:{ nodeItemTap:function(me,list,index,target,record,e){ debugger; var parentId=record.raw.TreeId; if(!target._record._data.expanded && !record.hasChildNodes()) { $.ajax({ url:"/Home/getJsonData/"+"&parentId="+parentId, method:"GET", gridRecord:record, gridMe:me, gridList:list, gridTarget:target, gridRecord:record, gridEvent:e, success:function(data){ var childrens=Ext.JSON.decode(data); for(var index in childrens){ this.gridRecord.insertChild(index,this.gridRecord.createNode(childrens[index])); } }, error:function(data){ console.log(data); } } }); } }

swluken commented 8 years ago

Hi, this is discussed in the forum starting at: https://www.sencha.com/forum/showthread.php?259616-TouchTreeGrid-component/page6

Note the discussion in the forum about needed override to handle sorting issue.

The latest demo of it can be seen at below address (the example of which is included in the download): http://www.gomainerentals.com/Sencha/DynamicLoadEx2C/index.html

Regards, Steve

ayush-srtv commented 8 years ago

Hi, Can you tell me how to get selected record from TreeGrid. I tried to implement a grid using your example of tasks, but i am stuck wondering how to get selected record in javascript.

swluken commented 8 years ago

TouchTreeGrid.controller.ProjectController from Kitchen Sink has listener for itemtap event: (this is "Project #3" example from http://www.gomainerentals.com/Sencha/TTG_KitchenSink/index.html)

        "list#example2Clist": {
            itemtap: 'onExample2ClistTap'
        }

onExample2ClistTap() method has record as one of the parameters. This method also shows how you can process a specific cell tap for treegrids.