Skip to main content

Widget Render Grid In Ext GWT

Widget Render 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.client.Examples;  
  7. import com.extjs.gxt.samples.resources.client.Resources;  
  8. import com.extjs.gxt.ui.client.Style.HorizontalAlignment;  
  9. import;  
  10. import;  
  11. import;  
  12. import;  
  13. import;  
  14. import;  
  15. import com.extjs.gxt.ui.client.event.ButtonEvent;  
  16. import com.extjs.gxt.ui.client.event.SelectionListener;  
  17. import;  
  18. import com.extjs.gxt.ui.client.widget.ContentPanel;  
  19. import com.extjs.gxt.ui.client.widget.LayoutContainer;  
  20. import com.extjs.gxt.ui.client.widget.button.Button;  
  21. import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;  
  22. import com.extjs.gxt.ui.client.widget.grid.ColumnModel;  
  23. import com.extjs.gxt.ui.client.widget.grid.Grid;  
  24. import com.extjs.gxt.ui.client.widget.layout.FitLayout;  
  25. import com.extjs.gxt.ui.client.widget.layout.FlowLayout;  
  26. import;  
  27. import;  
  28. import;  
  30. public class XmlGridExample extends LayoutContainer {  
  32.   @Override  
  33.   protected void onRender(Element parent, int index) {  
  34.     super.onRender(parent, index);  
  35.     setLayout(new FlowLayout(10));  
  37.     List<ColumnConfig> columns = new ArrayList<ColumnConfig>();  
  38.     columns.add(new ColumnConfig("Sender""Sender"100));  
  39.     columns.add(new ColumnConfig("Email""Email"165));  
  40.     columns.add(new ColumnConfig("Phone""Phone"100));  
  41.     columns.add(new ColumnConfig("State""State"50));  
  42.     columns.add(new ColumnConfig("Zip""Zip Code"65));  
  44.     // create the column model  
  45.     ColumnModel cm = new ColumnModel(columns);  
  47.     // defines the xml structure  
  48.     ModelType type = new ModelType();  
  49.     type.setRoot("records");  
  50.     type.setRecordName("record");  
  51.     type.addField("Sender""Name");  
  52.     type.addField("Email");  
  53.     type.addField("Phone");  
  54.     type.addField("State");  
  55.     type.addField("Zip");  
  57.     // Determine if Explorer or Example for XML path  
  58.     String path = GWT.getHostPageBaseURL() + (Examples.isExplorer() ? "" : "../../") + "data/data.xml";  
  60.     // use a http proxy to get the data  
  61.     RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path);  
  62.     HttpProxy<String> proxy = new HttpProxy<String>(builder);  
  64.     // need a loader, proxy, and reader  
  65.     XmlLoadResultReader<ListLoadResult<ModelData>> reader = new XmlLoadResultReader<ListLoadResult<ModelData>>(type);  
  67.     final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy,  
  68.         reader);  
  70.     ListStore<ModelData> store = new ListStore<ModelData>(loader);  
  71.     final Grid<ModelData> grid = new Grid<ModelData>(store, cm);  
  72.     grid.setBorders(true);  
  73.     grid.setLoadMask(true);  
  74.     grid.getView().setEmptyText("Please hit the load button.");  
  75.     grid.setAutoExpandColumn("Sender");  
  77.     ContentPanel panel = new ContentPanel();  
  78.     panel.setFrame(true);  
  79.     panel.setCollapsible(true);  
  80.     panel.setAnimCollapse(false);  
  81.     panel.setButtonAlign(HorizontalAlignment.CENTER);  
  82.     panel.setIcon(Resources.ICONS.table());  
  83.     panel.setHeading("XML Table Demo");  
  84.     panel.setLayout(new FitLayout());  
  85.     panel.add(grid);  
  86.     panel.setSize(575350);  
  88.     // add buttons  
  89.     Button load = new Button("Load XML"new SelectionListener<ButtonEvent>() {  
  90.       public void componentSelected(ButtonEvent ce) {  
  91.         loader.load();  
  92.       }  
  93.     });  
  95.     panel.addButton(load);  
  97.     add(panel);  
  99.   }  
  101. }  


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