javascript - Grouping values in grid panel after double clicking -


i want group values in grid panel

below code:

var store = ext.create('ext.data.treestore', { root: {     expanded: true,     children: [         { text: "school friends", expanded: true, children: [             { text: "mike", leaf: true, name: "mike", email: "mike@stackoverflow.com", phone: "345-2222"},             { text: "laura", leaf: true, name: "laura", email: "laura@stackoverflow.com", phone: "345-3333"}         ] },         { text: "facebook friend", expanded: true, children: [             { text: "steve", leaf: true, name: "steve", email: "steve@stackoverflow.com", phone: "345-2222"},             { text: "lisa", leaf: true, name: "lisa", email: "lisa@stackoverflow.com", phone: "345-3333"}         ] },     ] }});  ext.create('ext.tree.panel', { title: 'all friends', width: 200, height: 150, store: store, rootvisible: false, renderto: ext.getbody(), listeners : {         itemdblclick : function(tree, record, index){             ext.getstore('simpsonsstore').loadrawdata([record.raw], true);         } }}); ext.create('ext.data.store', { storeid:'simpsonsstore', fields:['name', 'email', 'phone'], data:{'items':[     { 'name': 'bart',  "email":"bart@simpsons.com",  "phone":"555-222-1234" },     { 'name': 'homer', "email":"home@simpsons.com",  "phone":"555-222-1244"  },     { 'name': 'marge', "email":"marge@simpsons.com", "phone":"555-222-1254"  } ]}, proxy: {     type: 'memory',     reader: {         type: 'json',         root: 'items'     } }});  ext.create('ext.grid.panel', { title: 'best friends', store: ext.data.storemanager.lookup('simpsonsstore'), columns: [     { text: 'name',  dataindex: 'name' },     { text: 'email', dataindex: 'email', flex: 1 },     { text: 'phone', dataindex: 'phone' } ], height: 200, width: 400, renderto: ext.getbody()}); 

from above code able values treepanel grid panel double clicking.

i want column group values if double click same leaf in treepanel.

for example if double click bart 6 times

name  email              phonenumber     groupby(number of times) bart  bart@simpsons.com   555-222-1234    6 

it should not append same value in grid panel. 1 please me.

regards, sreekanth

you'll need add count field store's fields. then, you'll need add field grid. when double-click tree, you'll need check store see if record exists. if does, change value in count field; otherwise, add new row.

        itemdblclick: function (tree, record, index) {             var s = ext.getstore('simpsonsstore'),                 existingrecidx = s.findby(function (r) {                     return r.get('email') === record.raw['email'];                 });              if (existingrecidx === -1) { //row not found                 record.raw.clickct = 1;                 s.loadrawdata([record.raw], true);             } else {                 var r = s.getat(existingrecidx);                 r.data.clickct++;                 grid.getview().refresh(); //once data has changed                                           //refresh grid             }         } 

see http://jsfiddle.net/kk7gl/


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -