Git Product home page Git Product logo

gwt-aggrid's Introduction

GWT JSInterop wrapping of popular grid library AG-Grid.

Getting Started

Gradle

Add AST Repo

  allprojects {
    repositories {
      ...
      maven { url 'https://maven.ascend-tech.us/repo' }
    }
  }

Add Dependency:

  compile 'us.ascendtech:agGrid:0.1.1'
  compile 'us.ascendtech:agGrid:0.1.1:sources'

Maven

Add AST Repo

  <repositories>
    <repository>
      <id>AST Maven</id>
      <url>https://maven.ascend-tech.us/repo</url>
    </repository>
  </repositories>

Add Dependency

  <dependency>
    <groupId>us.ascendtech</groupId>
    <artifactId>agGrid</artifactId>
    <version>0.1.1</version>
  </dependency>
  <dependency>
    <groupId>us.ascendtech</groupId>
    <artifactId>agGrid</artifactId>
    <version>0.1.1</version>
    <classifier>sources</classifier>
  </dependency>

Example in Java

Add dependency to gwt.xml

<inherits name="us.ascendtech.AGGrid"/>

Make sure to inject AGGrid javascript on your ModuleLoad.

SimplePanel tableDiv = new SimplePanel();
tableDiv.getElement().setClassName("ag-theme-balham");
tableDiv.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);

GridOptions<T> gridOptions = new GridOptions<>();
gridOptions.setGridApi(new GridApi<>());
gridOptions.setAnimateRows(true);
gridOptions.setRowHeight(35);
JsArray<ColumnDefinition> columnDefs = new JsArray<>();
gridOptions.setColumnDefs(columnDefs);

ColumnDefinition<T> columnOne = new ColumnDefinition<>();
columnOne.setHeaderName("Column One");
columnOne.setField("columnOne"); // the member variable name in T
columnOne.setColId("columnOne");
columnOne.setSortable(true);
columnOne.setResizable(true);
columnDefs.push(columnOne);

// column with custom cell renderer
ColumnDefinition<T> columnTwo = new ColumnDefinition<>();
columnTwo.setHeaderName("Column One");
columnTwo.setField("columnOne"); // the member variable name in T
columnTwo.setColId("columnOne");
columnTwo.setSortable(true);
columnTwo.setResizable(true);
columnTwo.setCellRenderer(params -> {
	HTMLButtonElement alertButton = (HTMLButtonElement) DomGlobal.document.createElement("button");
	
	alertButton.addEventListener("click", event -> {
		DomGlobal.alert("button clicked!")
	});

	return alertButton;
});
columnDefs.push(columnTwo);

new AGGrid<>(Js.cast(tableDiv.getElement()), gridOptions);

JsArray<T> currentData = new JsArray<>();
// add data objects

gridOptions.getGridApi().setRowData(currentData);
gridOptions.getGridApi().sizeColumnsToFit();

Please refer to gwt-examples to see it used in a real project.

gwt-aggrid's People

Contributors

mdavis95 avatar payammeyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

stillywud

gwt-aggrid's Issues

Please add licence information

Hi,
we are interrestet to use your project but can´t find any licence information.
Can you please add some information.

Big thanks
Quentin

Java 8

how we can make it compile as Java Version to 8 .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.