Toolbar requirements:
(1) requires that the toolbar be generated in JSON configuration format, which controls the state of the button at the UI level from the server side to control the generated JSON
(2) You can customize the icon style of the button.
(3) button events can be defined, and button events need to be supported as String definitions (server-side button JSON configuration events are configured as strings)
(4) Support toolbar global events, that is, click on any button to trigger the event
(5) Support for programmatically disabling, enabling, adding, deleting buttons
(6) Support configuration of additional event parameters, consider the parameters with permission flags
(7) Toolbars need to be considered for easy integration into the tree component, DataGrid, and other UI components that may need to be used in the toolbar
(8) If it is a server-side generation toolbar, in order to facilitate the management of toolbar events, consider defining the toolbar's events into an event collection under the current Page window object
Toolbar API Design:
One, josn configuration definition:
Global definition:
var defaultopts = { params:{},// data parameter for the button to be integrated into the tree DataGrid align: ' Left ',/ / alignment, default is left, center, right style: ' normal ',// Normal/min/plain // function () {}// events triggered by any button event, before the generic event is called, this= a tag };
A single button definition:
buttons=[{ID:' 04 ',//Button IDICONCLS: ",//icon StyleCMD: ' Test ',//the corresponding permission IDParams:{pr1:123},//Additional ParametersStatu:false,//is availableText: ' button ',//textClick:function(PR) {//Click event, if there is a click, handler is not available in string form}, Handler:' Events in string form ',//Use with MethodsobjectMethodsobject: ' Event set noun under Window object ' }]
Second, the API definition
Third, toolbar preview
Code Download:
Https://code.csdn.net/hjwen/open-ui/tree/master
Lightweight jquery Framework--Toolbars (toolbar)