Giter Club home page Giter Club logo

cud's Introduction

cud.js

标准的基于easyui datagrid的增删改操作都是这样的:一个datagrid展示数据,用户可以选择某一行数据进行删除、编辑操作,或者通过点击按钮添加数据,其中修改、添加操作是通过弹窗实现的。要实现这样的功能,我们必须进行以下一系列操作:编写窗口html代码、初始化dialog、初始化dialog中的组件(combobox、validatebox、combotreee等)、编辑时将数据带到窗口的form中、CUD后刷新datagrid等等。每来一个CURD页面,我们就必须重复以上操作。

于是,我将这些操作封装起来,形成cud.js。使用cud.js,用户只需定义字段信息(类型、名称等),增删改的url就能实现基本的cud操作。其还提供各种操作回调应对各种特殊情况。

使用示例

var curd = new CUD("funcWin",{
    //各种字段信息
	protFuncId : {type : 'hidden'},
	abbre : {
		type : "validatebox",text : "简称"
	},
	name : {
		type : "validatebox",text : "名称"
	},
	type : {
		type : "combobox",text : "类型",options : {
			data : [{
				value : "pack",text : "预处理"
			},{
				value : "data",text : "数据项"
			},{
				value : "time",text : "时间"
			}]
		}
	},
	paraDesc : {
		type : "textarea",text : "参数说明",colspan : 2
	},
	funcDesc : {
		type : "textarea",text : "函数说明",colspan : 2
	},
	notes : {
		type : "textarea",text : "备注",colspan : 2
	}
},{
  //配置项
	gridId : "grid",
	idField : "protFuncId",
	textField : "name",
	name : "函数",
	addUrl : "saveData.do",
	editUrl : "saveData.do",
	delUrl : "deleteData.do"
});

更多内容以及使用方法请查看源码。

cud's People

Contributors

weeksun23 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.