Giter VIP home page Giter VIP logo

future-architect / cheetah-grid Goto Github PK

View Code? Open in Web Editor NEW
1.4K 34.0 116.0 17.4 MB

The fastest open-source data table for web.

Home Page: https://future-architect.github.io/cheetah-grid/

License: MIT License

JavaScript 57.48% HTML 1.50% CSS 0.31% Vue 5.28% TypeScript 35.17% Stylus 0.03% Handlebars 0.14% Dockerfile 0.09%
data-table canvas spreadsheet grid javascript javascript-library vue-component vue-components

cheetah-grid's Introduction

Cheetah Grid

GitHub npm npm npm npm npm Build Status

Cheetah Grid

The fastest open-source data table for web.

capture.png

DEMO & Documents

Downloading Cheetah Grid

Using Cheetah Grid with a CDN

npm

<script src="https://unpkg.com/[email protected]"></script>

Downloading Cheetah Grid using npm

npm

npm install -S cheetah-grid
import * as cheetahGrid from "cheetah-grid";

// or

const cheetahGrid = require("cheetah-grid");

Downloading Cheetah Grid source code

npm

cheetahGrid.es5.min.js

SourceMap
cheetahGrid.es5.min.js.map

Downloading Cheetah Grid using GitHub

GitHub package version

git clone

git clone https://github.com/future-architect/cheetah-grid.git

npm install & build

npm install
npm run build

built file is created in the ./packages/cheetah-grid/dist directory

Usage

Example for basic usage

<div id="sample" style="height: 300px; border: solid 1px #ddd;"></div>
<script>
  // initialize
  const grid = new cheetahGrid.ListGrid({
    // Parent element on which to place the grid
    parentElement: document.querySelector("#sample"),
    // Header definition
    header: [
      {
        field: "check",
        caption: "",
        width: 50,
        columnType: "check",
        action: "check",
      },
      { field: "personid", caption: "ID", width: 100 },
      { field: "fname", caption: "First Name", width: 200 },
      { field: "lname", caption: "Last Name", width: 200 },
      { field: "email", caption: "Email", width: 250 },
    ],
    // Array data to be displayed on the grid
    records,
    // Column fixed position
    frozenColCount: 2,
  });
</script>

Please refer to the documents for details

Using the Vue Component of Cheetah Grid
Please refer to the vue-cheetah-grid

Using the React Component of Cheetah Grid
Please refer to the react-cheetah-grid

Definition of columns and headers

The header property, the property of cheetahGrid.ListGrid, decides the behave and appearance of columns and header cells. We can set this property by constructor arguments or instance property.

The header property must be set by objects array (Array<object>). In the standard definition, each object consists of following properties.

Property Description
caption define the header caption
field define the field name or function of the record to display in the cell
width (optional) define the width of column
columnType (optional) define the type of column
style (optional) define the style of column
action (optional) define the action of column

To use multiple header, set the hierarchical structured Object to the header property.

const grid = new cheetahGrid.ListGrid({
  //...
  header: [
    //...
    {
      /* multiple header */
      caption: "Name",
      columns: [
        { field: "fname", caption: "First Name", width: 200 },
        { field: "lname", caption: "Last Name", width: 200 },
      ],
    },
    //...
  ],
  //...
});

Definition of column type

Set the column type by using columnType.

For example, you can set the following strings:

Property Description
none draw text in the cell
'number' draw number in the cell with comma-separated
'check' draw checkbox in the cell
'button' draw button in the cell
'image' draw image in the cell
'multilinetext' draw multiline text in the cell

If you define a class instance you can define an advanced column types.

Please refer to the column types documents for details

Definition of column action

Define column action by using action property.

action Description
'check' make the check box clickable.
'input' make the cell enterable.

If you define a class instance you can define an advanced column actions.

Please refer to the column actions documents for details

Definition of column style

Define column style by using style property.

Properties below are prepared in standard.

Property Description
color define the color of cell.
textAlign define the horizontal position of text in cell.
textBaseline define the vertical position of text in cell.
bgColor define the background color of cell.
font define the font of cell.
padding define the padding of cell. if you set 4 values separately, please set the Array.
textOverflow define how to display when text overflows the area of a cell. clip or ellipsis is available.

In addition, there is an extended style property for each column type.


Please refer to the documents for details

License

See the LICENSE file for license rights and limitations (MIT).

Supporting Cheetah Grid

sponsors

cheetah-grid's People

Contributors

acherkashin avatar amndeep7 avatar jwesorick avatar ota-meshi avatar shibukawa avatar yasu-murata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cheetah-grid's Issues

Unable to get intro example working - any help would be appreciated.

Hi, Thank you for your work on this library. It looks great.

Apologies for what is surely a dumb question; I'm a newb at front-end development.

I am trying to get the basic example working with an array of records but it doesn't render the grid. I think I must be missing a call.

My code looks like this


<div class="grid-sample" style="height: 500px; border: solid 1px #ddd;"></div>

<script type="text/javascript">
const grid = new cheetahGrid.ListGrid({
  parentElement: document.querySelector('.grid-sample'),
  header: [
    {field: 'personid', caption: 'ID', width: 100},
    {field: 'fname', caption: 'First Name', width: 200},
    {field: 'lname', caption: 'Last Name', width: 200},
    {field: 'email', caption: 'Email', width: 250},
  ],
  frozenColCount: 1,

  // Array data to be displayed on the grid
  records: [
  {'personid': 1, 'fname': 'Sophia', 'lname': 'Hill', 'email': '[email protected]'},
  {'personid': 2, 'fname': 'Aubrey', 'lname': 'Martin', 'email': '[email protected]'},
  {'personid': 3, 'fname': 'Avery', 'lname': 'Jones', 'email': '[email protected]'},
  {'personid': 4, 'fname': 'Joseph', 'lname': 'Rodriguez', 'email': '[email protected]'},
  {'personid': 5, 'fname': 'Samuel', 'lname': 'Campbell', 'email': '[email protected]'},
  {'personid': 6, 'fname': 'Joshua', 'lname': 'Ortiz', 'email': '[email protected]'},
  {'personid': 7, 'fname': 'Mia', 'lname': 'Foster', 'email': '[email protected]'},
  {'personid': 8, 'fname': 'Landon', 'lname': 'Lopez', 'email': '[email protected]'},
  {'personid': 9, 'fname': 'Audrey', 'lname': 'Cox', 'email': '[email protected]'},
  {'personid': 10, 'fname': 'Anna', 'lname': 'Ramirez', 'email': '[email protected]'}
],
});
</script>

There are no console errors. it creates the divs inside the parent, but doesn't render the table itself.

Beyond this issue, I think (FWIW) it might be easier to learn the library if the example pages had just one example (JS or Vue, rather than both) and didn't include the code viewers - just a working example. If you can look at the code by doing a view source, and there's nothing their but a working example, it might have been easier to see why my code doesn't work.

Thanks again.

Header Caption

Hi,

How can I change header's caption after rendered.

thanks

Tooltip

How can I show tooltip for cell where text is cut off?

Drag drop column

Hi,

Thank you for your great job,

Is it possible to change the order of columns by dragging and droping?

In a flexbox based layout canvas height is too tall.

CGird ()

When use percentage/flexbox based layout the canvas height is being set too tall. The canvas width is correct but height is being calculated incorrectly. Note: This page has multiple div's with flex/percentage height widths set.

パーセント・フレックスボックスレイアウト専用ページでカンバス高さは高すぎる。カンバスの広さはちょうどいいです。備考:このページマルチDIVあり(フレックス・パーセント)。他のコンポネントはこの問題発生してないです。

div.cheetah-grid 1200x378
div.cheetah-grid canvas 1200x443

Cannot read property 'columns' of undefined with Vue

Your project looks really cool and exactly what we're looking for but when I try to use it - even pasting your provided Vue templates - I get the following error:

vue.js:1743 TypeError: Cannot read property 'columns' of undefined
    at VueComponent.createColumn (vueCheetahGrid.js:9)
    at vueCheetahGrid.js:9
    at vueCheetahGrid.js:9
    at Array.map (<anonymous>)
    at x (vueCheetahGrid.js:9)
    at O (vueCheetahGrid.js:9)
    at $ (vueCheetahGrid.js:9)
    at VueComponent.mounted (vueCheetahGrid.js:9)
    at callHook (vue.js:2921)
    at Object.insert (vue.js:4152)

How to reset sort order

Hi..

If you operate in the following order, the display of the sort order will remain.

  1. Set display data in Grid and display
  2. Select column header and specify sort order
  3. Resetting the latest data in Grid

You can reset the sort order by executing the following code, but can not you do it a bit easier?

// grid is cheetah-grid object
grid.sortState = {
    col: -1,
    order: undefined
}

Thanks.

RowColor

Hi..

I want to change row color easily at once.

But check box, menu, and button cells are not color-coded. right?

thanks.

render problem on ios 13

on ios 13 safari

Removed Features
Removed support for WebSQL.
Removed support for Legacy Safari Extensions.
Disabled -webkit-overflow-scrolling: touch on iPad. All frames and scrollable overflow areas >now use accelerated one-finger scrolling without changing stacking.
Disabled frame flattening on iOS. Frames now render in the same way as a desktop browser.

Disabled -webkit-overflow-scrolling: touch this feature lead momentum scrolling is turned on at default, this cased some problem when scroll out of range

image

would you please fix this problem

thank you

feature requests

This rather a feature request as an issue.
Is there any possibility to:

  • have column footer (for sums,count, avg, etc)
  • have nested tables (a kind of master/detail)
  • have grouping of row data

Can I use Summary row?

Can I use a summary row?

I do not need a calculated summary row, but I need a summary row that is fixed and scrollable with its contents.

Thank you for great grid!

merge cell

Is there ability to merge column cells? It would be great function to show duplicate column data.

check box in Header Caption

Hi.. recently i use your cheetah-grid.

but i have one question.

how to put check box in header caption. not rows...

thanks.

Error occurred at column addition timing.

Hi..

I am creating a variable column table.
The following error message will be displayed at the timing of adding the column.
Could you tell me if you know the solution?
"Error: unknown tag: vue-component-9-CGridColumnGroup"

   <c-grid-column-group v-for="row in record"
                       :key="row.id"
                       :caption="row.groupname">
     <c-grid-input-column :field="row.id"
                          :caption="row.name"
                          input-type="String">
     </c-grid-input-column>
  </c-grid-column-group>
record.push({
  id: 9999
  groupname: hoge
  name: fuga
})

Thanks.

Is there a way to have select an entire column?

I would like to have the ability to add a checkbox next to the column header name that would "select" the column and add a style on it. I can't seem to find a way to add a checkbox (or any piece of non-text) to the header. I'd be happy to contribute if this functionality isn't already there. I doesn't seem like it would be too bad to add in a boolean input in c-grid-input column header and have it trigger header-action. I'm working in Vue for this.

Korean IME Input error

Hello,

I've found your awesome project, and considering to use my project.

but I found korean input error when edit columns.
may-21-2018 14-23-26

My env:
OS : OSX 10.13.4 (17E202)
Browser: Chrome 66.0.3359.139 (Official Build) (64-bit)

Html in cell

Hi,

is it possible to write HTML in a cell ?

thanks

Font option

When I set 'headerStyle: {
textAlign: 'center',
font: '20px Microsoft Yahei'
}'
The font option wasn't applied
@ota-meshi

I want to change the color of the sort arrow

Hi..

When the background color of the header is darkened, the sort arrow is hard to see.
Even if you specify a color, it does not apply to sort arrows, so we want you to specify the color of the sort arrow.

Thanks.

Resize event

Is there ability to subscribe on resize column? It would be useful options to save column width and apply it in future.

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.