ASP. NET Aries getting started development tutorial 7: Row Operations of the DataGrid (primary key operation area), ariesdatagrid

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.