成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

React 表格組件 GridManager-React

cyixlq / 1523人閱讀

摘要:基于的封裝用于便捷的在中使用除過特性外,其它與相同。刷新更新查詢條件其它更多請直接訪問查看當(dāng)前版本的版本的版本

GridManager React
基于 React 的 GridManager 封裝, 用于便捷的在 React 中使用GridManager. 除過React特性外,其它API與GridManager API相同。

實現(xiàn)功能

寬度調(diào)整: 表格的列寬度可進行拖拽式調(diào)整

位置更換: 表格的列位置進行拖拽式調(diào)整

配置列: 可通過配置對列進行顯示隱藏轉(zhuǎn)換

表頭吸頂: 在表存在可視區(qū)域的情況下,表頭將一直存在于頂部

排序: 表格單項排序或組合排序

分頁: 表格ajax分頁,包含選擇每頁顯示總條數(shù)和跳轉(zhuǎn)至指定頁功能

用戶偏好記憶: 記住用戶行為,含用戶調(diào)整的列寬、列順序、列可視狀態(tài)及每頁顯示條數(shù)

序號: 自動生成序號列

全選: 自動生成全選列

導(dǎo)出: 當(dāng)前頁數(shù)據(jù)下載,和僅針對已選中的表格下載

右鍵菜單: 常用功能在菜單中可進行快捷操作

過濾: 通過對列進行過濾達(dá)到快速搜索效果

API
該文檔為原生GridManager的文檔,react版本除了在columnData.text columnData.template topFullColumn.template中可以使用react模版外,其它使用方式相同。

API

Demo
該示例為原生GridManager的示例,react版本除了在columnData.text columnData.template topFullColumn.template中可以使用react模版外,其它使用方式相同。

簡單的示例

復(fù)雜的示例

Core code

GridManager

jTool

開發(fā)環(huán)境

ES2015 + webpack + React + GridManager

項目中引用

es2015引入方式

import ReactGridManager, {$gridManager} from "gridmanager-react";
import "gridmanager-react/css/gm-react.css";

通過script標(biāo)簽引入


示例
import ReactDOM from "react-dom";
import React, { useState } from "react";
import ReactGridManager, { $gridManager } from "gridmanager-react";
import "gridmanager-react/css/gm-react.css";

// 組件: 操作列
function ActionInner(props) {
    const actionAlert = event => {
        alert("操作欄th是由React模板渲染的");
    };
    return {props.text};
}

function ActionComponents(props) {
    return ;
}

// 組件: 空模板
function EmptyTemplate(props) {
    return (
        
{props.text}
); } // 組件: 標(biāo)題 function TitleComponents(props) { return ( {props.row.title} ); } // 組件: 類型 function TypeComponents(props) { // 博文類型 const TYPE_MAP = { "1": "HTML/CSS", "2": "nodeJS", "3": "javaScript", "4": "前端雞湯", "5": "PM Coffee", "6": "前端框架", "7": "前端相關(guān)" }; return ( ); } // 組件: 刪除 function DeleteComponents(props) { const {index, row} = props; const deleteAction = event => { if(window.confirm(`確認(rèn)要刪除當(dāng)前頁第[${event.target.getAttribute("data-index")}]條的["${event.target.title}]?`)){ console.log("----刪除操作開始----"); $gridManager.refreshGrid(option.gridManagerName); console.log("數(shù)據(jù)沒變是正常的, 因為這只是個示例,并不會真實刪除數(shù)據(jù)."); console.log("----刪除操作完成----"); } }; return ( 刪除 ); } // 表格組件配置 const option = { gridManagerName: "testReact", height: "100%", emptyTemplate: , columnData: [{ key: "pic", remind: "the pic", width: "110px", text: "縮略圖", template: (pic, row) => { return ( ); } },{ key: "title", remind: "the title", text: "標(biāo)題", template: },{ key: "type", remind: "the type", text: "分類", align: "center", template: (type, row, index) => { return ; } },{ key: "info", remind: "the info", text: "使用說明" },{ key: "username", remind: "the username", text: "作者", // 使用函數(shù)返回 dom node template: (username, row, index) => { return ( {username} ); } },{ key: "createDate", remind: "the createDate", width: "100px", text: "創(chuàng)建時間", sorting: "DESC", // 使用函數(shù)返回 htmlString template: function(createDate, rowObject){ return new Date(createDate).toLocaleDateString(); } },{ key: "lastDate", remind: "the lastDate", width: "120px", text: "最后修改時間", sorting: "", // 使用函數(shù)返回 htmlString template: function(lastDate, rowObject){ return new Date(lastDate).toLocaleDateString(); } },{ key: "action", remind: "the action", width: "100px", disableCustomize: true, text: , // 快捷方式,將自動向組件的props增加row、index屬性 template: }], supportRemind: true, isCombSorting: true, supportAjaxPage: true, supportSorting: true, ajax_data: "http://www.lovejavascript.com/blogManager/getBlogList", ajax_type: "POST", }; // 渲染回調(diào)函數(shù) const callback = query => { console.log("callback => ", query); }; ReactDOM.render( , document.querySelector("#example") );
調(diào)用公開方法
通過ES6語法,將$gridManager引入。
import { $gridManager } from "gridmanager-react";

// 刷新
$gridManager.refreshGrid("testReact");

// 更新查詢條件
$gridManager.setQuery("testReact", {name: "baukh"});

// ...其它更多請直接訪問API
查看當(dāng)前版本
import GridManagerReact, {$gridManager} from "gridmanager-react";
console.log("GridManagerReact 的版本=>", GridManagerReact.version);
console.log("GridManager 的版本=>", $gridManager.version);

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/104626.html

相關(guān)文章

  • React 實現(xiàn) Table 的思考

    摘要:加這兩個屬性的原因很容易想到,因為我們在寫表格相關(guān)業(yè)務(wù)時,樣式里面寫的最多的就是單元格的寬度和對齊方式。然而,寫的表格后粘貼在中,整行的內(nèi)容都在一個單元格里面,用寫的表格則能夠幾乎保持原本的格式,所以我們這次用了原生的來寫表格。 Table 是最常用展示數(shù)據(jù)的方式之一,可是一個產(chǎn)品中往往很多非常類似的 Table,但是我們碰到的情況往往是 Table A 要排序,Table B 不需要...

    ChanceWong 評論0 收藏0
  • 從零開始的 React 組件開發(fā)之路 (一):表格

    摘要:下的表格狂想曲前言歡迎大家閱讀從零開始的組件開發(fā)之路系列第一篇,表格篇。北京小李中的每一個元素是一列的配置,也是一個對象,至少應(yīng)該包括如下幾部分表頭該列使用行中的哪個進行顯示易用性與通用性的平衡易用性與通用性互相制衡,但并不是絕對矛盾。 React 下的表格狂想曲 0. 前言 歡迎大家閱讀「從零開始的 React 組件開發(fā)之路」系列第一篇,表格篇。本系列的特色是從 需求分析、API 設(shè)...

    DesGemini 評論0 收藏0
  • React 導(dǎo)讀(三)

    摘要:場景為了更清晰的安排年前年后的工作和值班,現(xiàn)在要對過年期間人員請假的情況進行統(tǒng)計,并且進行一個簡單的管理。我們現(xiàn)在來訂閱一個名為的事件,用來表示表格中需要展示每條數(shù)據(jù)。 前言 React 導(dǎo)讀(一)React 導(dǎo)讀(二) 在之前 2 篇文章中中學(xué)習(xí)到了寫第一個 Web 組件以及常用的生命周期函數(shù)的使用,這篇文章將繼續(xù)之前的目錄,開始新的知識點補充: [x] React 如何編寫 He...

    zzir 評論0 收藏0
  • react可高度配置表格/列表組件react-tabllist)

    摘要:最近因項目需要,找了很久的列表滾動組件,雖然有類似的組件,但是功能完全不是我想要的,無奈之下,自己手寫了一個可高度配置列表組件,現(xiàn)在貼出來以供需要的小伙伴使用。演示地址本組件持續(xù)更新中,歡迎你的。 最近因項目需要,找了很久的React列表/滾動組件,ant design雖然有類似的組件,但是功能完全不是我想要的,無奈之下,自己手寫了一個可高度配置react列表組件,現(xiàn)在貼出來以供需要的...

    hiyayiji 評論0 收藏0
  • 支持多框架的組件庫KPC 1.0正式發(fā)布

    摘要:自從年月份對外公布以來,已經(jīng)經(jīng)過了個月的迭代,期間發(fā)布了幾十個正式版本,但一直沒有到,因為我們覺得是個里程碑版本,我們必須做的足夠完善才敢稱之為。 自從17年11月份對外公布以來,KPC已經(jīng)經(jīng)過了8個月的迭代,期間發(fā)布了幾十個正式版本,但一直沒有到1.0,因為我們覺得1.0是個里程碑版本,我們必須做的足夠完善才敢稱之為1.0。而如今我們有信心對外宣布:KPC 1.0終于來了! 其實距離...

    劉厚水 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<