ASP. NET Aries getting started development tutorial 7: Row Operations of the DataGrid (primary key operation area), ariesdatagrid
Preface:
The series is expected to end in 10 articles.
Previous Introduction: ASP. NET Aries getting started development tutorial 6: formatting and In-row editing of List Data Tables
This topic describes the primary key operation area.
1: When is there any default edit or delete?
The default operation area is available and the edit and delete icons appear only when row editing is enabled (and the corresponding permission is available.
var dg = new AR.DataGrid("Article", "Article", "grid"); dg.isEditor = true; ....
2: What are the default icons?
By default, JS only defines the following items (edit, del, detail, save, and cancel ):
However, you can create new icons to expand your own icons or events.
3: how to add new icons and events?
Sample Code:
Effect:
4: How do I customize small icons?
You can define AR. Global. DG. PKTemplate. XXX = '<a...> </a>' on the page ';
Then dg. PKColumn. add ("xxx"...); call
5: how to display or hide icons based on different conditions of data rows?
Sample Code:
Var dg = new AR. dataGrid ("Article", "Article", "grid"); dg. PKColumn. add ("edit", "edit", null, "userEidt.html", "edit user", "edit"); dg. PKColumn. add ("del", "delete data", null, "del"); dg. PKColumn. add ("detail", "view image", "fn", null, null, "view"); // dg. PKColumn. onBeforeExecute = function (value, row, index, btnArray) {// btnArray [0]. isHidden = index % 2 = 0; //} dg. PKColumn. onAfterExecute = function (value, row, index, $ div) {if (index % 2 = 0) {this. items [index] ["edit" ].css ("visibility", "hidden") ;}} dg. bind ();
Effect:
PS: Knowledge supplement:
1: The event of the PKColumn object intercepts each row. 2: If you control the isHidden attribute of btnArray in onbeforeExecute, the icon will not be loaded (but there is no way to control the placeholder, and the format will not be good) 3: select the control visability attribute in onAfterExecute to hide the icon.
Summary:
This topic describes the functional area of primary key operations.
Next, we will introduce the tree list and right-click Menu customization.