"Workaround" Easyui no data issues when the DataGrid does not display scroll bars

Source: Internet
Author: User

Workaround

For the DataGrid For example, the following code is added to the definition:

JavaScript Code
1
2
3
4
5
6
7
8
9
10
Onloadsuccess:function(data) {
if(Data.total = =0) {
$(' #dg '). DataGrid (' InsertRow ', {
Row: {}
});
$("#dg"). Parent (). Find ("tr[datagrid-row-index= ' 0 ']"). CSS ({
"Visibility":"Hidden"
});
}
}

Update log

By the @ Cloud flying classmate guidance, the above part of the code to make changes.

Here are the comments from the @ Cloud flying Classmates:


The whole idea is correct, just need to change the selection under the limit, otherwise it will affect all the DataGrid, will all the first row of the DataGrid to hide out.
Easyui handles the DataGrid by preserving and encapsulating the table portion of the ID, adding datagrid-view1 and datagrid-view2 two child elements, which form a sibling relationship between the view and the original table. The first view is used to place frozen columns, and there is data in the frozen column.

View2 to place data in the natural column. So, the scope of the code should be written like this:

[JavaScript]View Plaincopyprint

"Style=" Color:rgb (204,204,204); Text-decoration:none; Border:none; padding:0px; margin:0px 10px 0px 0px; font-size:9px; Background-color:inherit "?

  1. $ ( "#dg" "tr[datagrid-row-index= ' 0 ']"
  2. "Visibility"  :  "Hidden"   
Original code:

JavaScript Code
1
2
3
4
5
6
7
8
9
10
11
Onloadsuccess:function(data) {
if(Data.total = =0) {
$(' #dg '). DataGrid (' InsertRow ', {
Row: {}
});
$("tr[datagrid-row-index= ' 0 ']"). CSS ({
"Visibility":"Hidden"
});
}
}


Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Workaround Easyui There is no data problem when the DataGrid does not display scroll bars

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.