Javascript based excel slicer

栏目: IT技术 · 发布时间: 5年前

内容简介:Provide the Excel slicer capability to websites. Simple implementation to help filter table or datasets using visual feedback.Optional

Slicer-JS

Provide the Excel slicer capability to websites. Simple implementation to help filter table or datasets using visual feedback.

Javascript based excel slicer

Dependencies

  • jQuery (3.4.1) - so I don't need to worry about cross browser issues LOL
  • jQuery-UI (1.12.1) - for resize and draggable (cause HTML5 drag-n-drop scares me)
  • Bootstrap (4.0.0) - mainly used for theoption
  • FontAwesome (5.10.0) - button icons on slicer title bar

Install

<link type="text/css" rel="stylesheet" href="../dist/css/slicer-js.min.css" />
<script type="text/javascript" src="../dist/js/slicer-js.min.js"></script>

Usage

<script type="application/javascript">
    document.addEventListener('DOMContentLoaded', function(){
        //BASIC CREATE
        (new Slicer())
                .attach({
                            container: $('#example'),
                            field: 'Position'})
                .make_editable();

        //ALL OPTIONS CREATE
        (new Slicer())
                .attach({
                            container: $('#example'),
                            dataset: null,
                            style: 'secondary',
                            title: 'Age of Staff', 
                            field: 'Age',
                            top: '100px',
                            left: '300px',
                            width: '180px',
                            height: '300px',
                            on_change: function(){
                                console.log('START save change to age')
                            },
                            on_before_change: function(){
                                console.log('STOP save change to age')
                            }
                        })
                .make_editable();
    });

</script>

Options

container

Optional

Only ommit this value (or set it to null ) if you are providing thevalue.

Container into which the slicer should be created. If no dataset is provided, it will assume the container is an HTML table and then convert it to a dataset.

field

Mandatory

This is the field whose unique list of value should be shown in the slicer

dataset

Optional

Default : null

Only omit this value if you are providing an HTML table in thefield.

Object representing the data to render into the slicer.

{
   name    : "unique-name",   //string value
   header  : [...],           //array representing the header row
   rows    : [[...]],         //array of arrays representing the data rows in the table
}

title

Optional

Default : When omited it will use thevalue

Title to display for the slicer. When the title is omited it will use the field value.

width

Optional

Default : 400px

Width of slicer

height

Optional

Default : 200px

Height of slicer

top

Optional

Default : 200px

Absolute "top" position relative to the page

left

Optional

Default : 200px

Absolute "left" position relative to the page

style

Optional

Default : primary

This is a combination of the "default" bootstrap themes and some custom themes which is defined in the css files provided possible values are:

Bootstrap colors

  • light
  • primary
  • warning
  • danger

Custom colors

  • heritage-green
  • fresh-green
  • future-green
  • sky
  • sun
  • naartjie
  • cerise

on_change

Optional

Callback function after the user made a selection on the page

function(){
   console.log('call after user selected items on slicer');
}

on_before_change

Optional

Callback function BEFORE the user selection is applied to the table/dataset

function(){
   console.log('call made before selection is applied');
}

Related

This is one of the components used in the biznous.net platform

Licence

The javascript component slicer-js is released under the MIT license


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

尽在双11:阿里巴巴技术演进与超越

尽在双11:阿里巴巴技术演进与超越

阿里巴巴集团双11技术团队 / 电子工业出版社 / 2017-4 / 79

“双 11”,诞生于杭州,成长于阿里,风行于互联网,成就于新经济,贡献于全世界。 从 2009 年淘宝商城起,双 11 已历经八年。每年的双 11 既是当年的结束,又是走向未来的起点。技术的突破创新,商业模式的更替交互,推动着双 11 迈步向前。 《尽在双11——阿里巴巴技术演进与超越》是迄今唯一由阿里巴巴集团官方出品、全面阐述双 11 八年以来在技术和商业上演进和创新历程的书籍。内容......一起来看看 《尽在双11:阿里巴巴技术演进与超越》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具