Skip to main content

Grouping Example Grid In Ext GWT

Grouping Example Grid In Ext GWT Sample Code

  1. package com.extjs.gxt.samples.client.examples.grid;  
  3. import java.util.ArrayList;  
  4. import java.util.List;  
  6. import com.extjs.gxt.samples.resources.client.Resources;  
  7. import com.extjs.gxt.samples.resources.client.TestData;  
  8. import com.extjs.gxt.samples.resources.client.model.Stock;  
  9. import;  
  10. import com.extjs.gxt.ui.client.widget.ContentPanel;  
  11. import com.extjs.gxt.ui.client.widget.LayoutContainer;  
  12. import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;  
  13. import com.extjs.gxt.ui.client.widget.grid.ColumnModel;  
  14. import com.extjs.gxt.ui.client.widget.grid.Grid;  
  15. import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;  
  16. import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;  
  17. import com.extjs.gxt.ui.client.widget.grid.GroupingView;  
  18. import com.extjs.gxt.ui.client.widget.layout.FitLayout;  
  19. import com.extjs.gxt.ui.client.widget.layout.FlowLayout;  
  20. import;  
  21. import;  
  23. public class GroupingGridExample extends LayoutContainer {  
  25.   @Override  
  26.   protected void onRender(Element parent, int index) {  
  27.     super.onRender(parent, index);  
  28.     setLayout(new FlowLayout(10));  
  30.     GroupingStore<Stock> store = new GroupingStore<Stock>();  
  31.     store.add(TestData.getCompanies());  
  32.     store.groupBy("industry");  
  34.     ColumnConfig company = new ColumnConfig("name""Company"60);  
  35.     ColumnConfig price = new ColumnConfig("open""Price"20);  
  36.     ColumnConfig change = new ColumnConfig("change""Change"20);  
  37.     ColumnConfig industry = new ColumnConfig("industry""Industry"20);  
  38.     ColumnConfig last = new ColumnConfig("date""Last Updated"20);  
  39.     last.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));  
  41.     List<ColumnConfig> config = new ArrayList<ColumnConfig>();  
  42.     config.add(company);  
  43.     config.add(price);  
  44.     config.add(change);  
  45.     config.add(industry);  
  46.     config.add(last);  
  48.     final ColumnModel cm = new ColumnModel(config);  
  50.     GroupingView view = new GroupingView();  
  51.     view.setShowGroupedColumn(false);  
  52.     view.setForceFit(true);  
  53.     view.setGroupRenderer(new GridGroupRenderer() {  
  54.       public String render(GroupColumnData data) {  
  55.         String f = cm.getColumnById(data.field).getHeader();  
  56.         String l = data.models.size() == 1 ? "Item" : "Items";  
  57.         return f + ": " + + " (" + data.models.size() + " " + l + ")";  
  58.       }  
  59.     });  
  61.     Grid<Stock> grid = new Grid<Stock>(store, cm);  
  62.     grid.setView(view);  
  63.     grid.setBorders(true);  
  65.     ContentPanel panel = new ContentPanel();  
  66.     panel.setHeading("Grouping Example");  
  67.     panel.setIcon(Resources.ICONS.table());  
  68.     panel.setCollapsible(true);  
  69.     panel.setFrame(true);  
  70.     panel.setSize(700450);  
  71.     panel.setLayout(new FitLayout());  
  72.     panel.add(grid);  
  73.     grid.getAriaSupport().setLabelledBy(panel.getHeader().getId() + "-label");  
  74.     add(panel);  
  75.   }  
  77. }  


  1. Thanks for sharing this very interesting grouping.


Post a Comment

Popular posts from this blog

Connect To JioFi Device Without Knowing The Passwords Using WPS

If someone in your home or your friends are using Jiofi device and he/she is not sharing the password with you then i am going to share you a simple trick, so you can easily connect to the jiofi router without the need of password and start using the unlimited internet.

This trick can be achieved using the WPS technology (Wi-Fi Protected Setup; originally, Wi-Fi Simple Config) is a network security standard to create a secure wireless home network.

Follow the steps to get the internet for free using the "WPS Push Button Method"
Go to your Wifi Settings in your smartphone device like Android Turn on your Wifi Click the option button and select the  "WPS push button" and you will be seeing the popup window like this below picture.
Now take your JioFi Device and in the right side, you will seeing the WPS button  Hold the WPS button for few moments and see the Jiofi display, so the wifi icon will blink. After few seconds, your smartphone device would have shared the Wifi…

Five More Indian Languages - Google Translate

Google Translate add 5 more indian language translation like Bengali, Gujarati, Kannada, Tamil and Telugu.Till Today Google Translation supports 63 languages. As a indian bloggger its a happy to announce that all indic languages sites and blogs become internationalized one. All indic bloggers and sites owners have to attach the google translate widgets to their sites so that the internationalized reader can realize the value of your blog and may be a chance of becoming the readers.

How to Add The Google Translate Widgets on Blog or Sites

Just Add the Below code to internationalized your blog or site

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
</script><script src="//"></script>

If you want to customize the Goog…

Samsung Android 6.0 Marshmallow Supported Devices

Android Marshmallow is finally available. List of Samsung Device that can be upgraded to Android 6.0 Marshmallow.

Samsung Galaxy S6 edge+ Samsung Galaxy Note5Samsung Galaxy A8Samsung Galaxy A7Samsung Galaxy S6 edgeSamsung Galaxy S6Samsung Galaxy Note 4Samsung Galaxy AlphaSamsung Galaxy S5