1. #1
    Sencha User
    Join Date
    Aug 2009
    Location
    Raleigh, NC
    Posts
    3
    Vote Rating
    0
    jaredhocutt is on a distinguished road

      0  

    Question Unanswered: Adding data to a GroupingView

    Unanswered: Adding data to a GroupingView


    I'm having a bit of trouble with adding data to a GroupingView and getting it to group correctly. On page load, I pass the initial data using a JsonReader that contains a entry with blank data and the group name, such that basically each possible group shows up with a single empty row under it. Then I have the groupclick event perform an ajax call to get the actual data for that group and add it to the store. However, when I do this, it creates a new group (with the same name as a group already showing) and then adds the data to it. I want the data to show under the existing group.

    Here is the code that I have doing this:

    Code:
    var store = new Ext.data.GroupingStore({
    	reader: new Ext.data.JsonReader({
    		root: 'counters',
    		fields: [
    			'definition',
    			'counter',
    			'col1',
    			'col2'
    		]
    	}),
    	proxy: new Ext.data.ScriptTagProxy({
    		url: 'http://example.com/json_data_with_groups_only.php'
    	}),
    	sortInfo: {
    		field: 'counter',
    		direction: 'asc'
    	},
    	groupField: 'definition',
    	autoDestroy: true
    });
    
    var columns = new Ext.grid.ColumnModel({
    	columns: [{
    		header: 'Definition',
    		dataIndex: 'definition'
    	}, {
    		header: 'Counter',
    		dataIndex: 'counter'
    	}, {
    		header: 'Column 1',
    		dataIndex: 'col1'
    	}, {
    		header: 'Column 2',
    		dataIndex: 'col2'
    	}],
    	defaults: {
    		sortable: true
    	}
    });
    
    var view = new Ext.grid.GroupingView({
    	forceFit: true,
    	hideGroupedColumn: true,
    	showGroupName: false,
    	startCollapsed: true,
    	groupTextTpl: '{text}'
    });
    
    var grid = new Ext.grid.GridPanel({
    	title: 'Stat Counter Manager',
    	store: store,
    	colModel: columns,
    	view: view,
    	width: 'fill',
    	autoHeight: true,
    	renderTo: 'stat_counters_grid'
    });
    
    grid.on('groupclick', function(grid, field, value, e) {
    	Ext.Ajax.request({
    		url: 'http://example.com/json_data_of_definition?counter_definition=' + value,
    		success: function(response) {
    			store.add(Ext.decode(response.responseText));
    		}
    	});
    });
    
    store.load();

  2. #2
    Sencha User
    Join Date
    May 2010
    Posts
    1
    Vote Rating
    0
    Trip is on a distinguished road

      0  

    Default


    jaredhocutt,

    I had a similar problem in my own project. I ended up using the sort function associated with the store.

    In this case after you do:

    Code:
    store.add(Ext.decode(response.responseText));
    do something like:

    Code:
    store.sort([{
      field: 'definition',
      direction: 'ASC'
    }],'ASC');
    you can also add additional sorting routines by adding them to the config:


    Code:
    store.sort([{
      field: 'definition',
      direction: 'ASC'
    },{
      field: 'counter',
      direction: 'ASC'
    }],'ASC');
    Cheers

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    5
    Vote Rating
    0
    johnsonkid is on a distinguished road

      0  

    Default


    THANK YOU
    i think i should thank you very much for you can waste lot of time to write this post .....
    thank you again for your sharing..



    Diablo 3 Gold


Similar Threads

  1. Adding a control to a group in a GroupingView
    By markmacumber in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 16 Aug 2009, 3:22 PM
  2. GroupingView: How to get a sum of a subset of data
    By MtAiryEd in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 28 May 2008, 4:42 AM
  3. Ext2.0 how get data in jsonStore after adding data manualy
    By denkoo in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 15 Mar 2008, 1:09 PM
  4. GroupingView : Trouble grouping columns with HTML as data (a bug...?)
    By dmhost in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 13 Jan 2008, 10:31 PM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi