Skip to content

jQuery DataTables and Editor - the evil #124

Open
@uniquejava

Description

@uniquejava

https://datatables.net/ and https://editor.datatables.net/

Compare jsgrid and datatables Getting Started Page

DataTables Getting Started

jsgrid Getting Started

I think you should already make up your mind now. the former very complex and hard to know what it says

The latter, simple and to the point, the clear interface includes all the functions that a table editor requires.

吐槽 Complaint

DataTables所有的列都要指定fields和columns (N多重复代码)
data, visible, className要定义在column里边, name, type要定义在fields里边, WTF?

jsgrid只要定义fields: name, visible和type等一个field轻松搞定, no brain-fuck.

DataTables的下拉框真的难用, 文档在tech notes里边(难找吧!)
https://datatables.net/manual/tech-notes/11
下拉字段是下面这样的形式
fields.push({name: 'FieldName', type: 'select', options: [{label:'', value:''}, ...] });
其中options必须是这种指定格式. 需要提前转换, jsgrid没有这个限制(无需转换)..

DataTables的editor还是收费的. 依赖一大堆组合, buttons是一个js, select又是一个js, 到底要下载哪些js分分钟把你搞晕

DataTables出了错竟然是弹出alert(这也太不友好了, 在console.log中打印出来不更好)
关键是warning类型的没有必要弹alert.

如何禁掉这个alert在此:
https://datatables.net/forums/discussion/28726/how-to-disable-the-warning-message

小技巧

访问nested array, 像这样: friends.0.name, friends.1.name

references

https://datatables.net/forums/discussion/29339/change-ajax-url

https://editor.datatables.net/reference/option/ajax.data

https://editor.datatables.net/reference/field/select

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions