Giter VIP home page Giter VIP logo

table-paginated-view's Introduction

Paginated Table

This is a table which allows dynamic paging for any list of objects. Icons can be added to columns as well as custom items such as check boxes and buttons.

Screen Shot of Paginated Table

Demonstration of Paginated Table

To view demonstration of the Paginated table download the [Android Component Project] (https://github.com/ojinxy/AndroidComponents) and compile using Android Studio. The downloaded project has the paginated table component as well as a demo application.

Using Paginated Table in Your Project

  1. In your Android Studio Project add the following to your build.gradle file.
    a. compile 'com.github.ojinxy.android-component:paginated-table:0.0.1'

  2. Create or reuse an Object which will hold row data. This object can be any POJO object. The functions which you want to feed data to the table can be annotated with the following annotations.
    1. @SortedMethod(value=2) This tells the order in which the item should appear in the row. 2.@Icon(fonttype="fontawesome-webfont.ttf",fontsize=30f,fontcolor="#000033") This tells which icon you want to appear on the column.
    [Fontawesome] (https://fortawesome.github.io/Font-Awesome/cheatsheet/) is included by default you can use any font libary you would like. You need to include the FontLib.tff in the src/main/assets/fonts directory under your project.

  3. Create a Object which extends GenericList

    1. Ensure the GenericList has a List<Object> objects which will be used for the pagination.
    2. Create a constructor similiar to the following code snippet.
      a. public DemoList(List<DemoRow> genericList, int rowsToDisplay, String pagingInfoType, boolean showColHeader, int rowsBeforeData, boolean allowSorting, SORTORDER defaultSortOrder, String defaultSortType) { super(Arrays.asList(genericList.toArray()), rowsToDisplay, pagingInfoType, showColHeader, rowsBeforeData, true, defaultSortOrder, defaultSortType); this.demoRows = genericList; this.setRowsToDisplay(rowsToDisplay); this.sortByArrayId = R.array.demosort; this.getMethodNames().add(0, "getCol1"); this.getMethodNames().add(1, "getCol2"); this.getMethodNames().add(2, "getCol3"); this.getHeaders().add(0,"Column 1"); this.getHeaders().add(1,"Column 2"); this.getHeaders().add(2,"Column 3"); }
      b. this.sortByArrayId = R.array.demosort; This R.array.demosort should be the integer id of an array string in string.xml of your android project.
    3. Override the following functions.
      1. getFunctionNameForSorting(String valueToCheck) This function maps the text on the sorting dropdown list to the actual values which will be used for sorting. See example bellow.
        @Override public String getFunctionNameForSorting(String valueToCheck) { if(valueToCheck.equalsIgnoreCase("Column 1")){ return "getCol1"; }else if(valueToCheck.equalsIgnoreCase("Column 2")){ return "getCol2"; }else if(valueToCheck.equalsIgnoreCase("Column 3")) { return "getCol3"; }else{return "getCol1";} }
      2. public Class<?> getClassToBeUsedForReflection() { return DemoRow.class; } This tells the paginated table which class to get data from via reflection.

    4.You can now instantiate a object from the GenericList Class you created. Then add it to the GenericTable. Then add the GenericTable.table to view the paginated table. See code bellow.

    GenericTable gentable = new GenericTable(context,"Demo Table",new ArrayList<String>( Arrays.asList("Column 1", "Column 2", "Column 3")),demoList); content.addView(gentable.table);

#Important Links Issues: [https://github.com/ojinxy/AndroidComponents/issues] (https://github.com/ojinxy/AndroidComponents/issues)
Web Site:
a.https://github.com/ojinxy/AndroidComponents
b.[https://bintray.com/onealanguin/maven/paginated-table/view] (https://bintray.com/onealanguin/maven/paginated-table/view)

#About Developer Name: Oneal Anguin
Email: [email protected]

#Contributors Name: Ricardo Thompson
Email: [email protected]

table-paginated-view's People

Contributors

ojinxy avatar

Watchers

James Cloos avatar Ranjan Kumar Singh avatar

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.