Dojo check box operations

Source: Internet
Author: User

 

Code

1 /*
2. the dojo framework must be introduced.
3. It is usually applicable to all or reselect operations in a container.
4. Check whether selected
5 Author: rnn
6 */
7 dojo. Declare (
"Checkboxclass ",
Null,
{
Container: "tableid",/* container ID */
Checkboxes: NULL,/* set of all check boxes, equivalent to a nodelist */
Count: 0,/* Number of current check boxes */
Selectedcount: 0,/* Number of selected check boxes that are currently easy to use */
Buttontype: 1,/* select the button type of the check box. 1 indicates itself is in the container. 2 indicates outside the container */
Constructor: function (container, buttontype ){
This. Container = container;
This. buttontype = buttontype;
This. checkboxes = dojo. Filter (Dojo. Query ("input", dojo. byid (this. Container), function (item ){
Return item. type = "checkbox ";
});
This. Count = This. checkboxes. Length-1;
VaR Index = 0;
VaR currentindex = 1;
If (this. buttontype = 2 ){
This. Count = This. Count + 1;
Currentindex = 0;
}
Dojo. foreach (this. checkboxes, function (item ){
If (index> = currentindex ){
Dojo. Connect (item, "click", itemcheckboxclick );
}
Index ++;
});
},/* Constructor, initialize some data */
Select: function (buttonid ){
VaR ischecked = dojo. byid (buttonid). checked;
If (ischecked ){
Dojo. foreach (this. checkboxes, function (item ){
Item. Checked = true;
});
This. selectedcount = This. count;
}
Else {
Dojo. foreach (this. checkboxes, function (item ){
Item. Checked = false;
});
This. selectedcount = 0;
}
},/* Select all events */
Checkselectedcount: function (){
If (this. selectedcount <= 0 ){
Alert ("no data selected ");
Return false;
}
Return true;
},
Setselectcount: function (type ){
If (type = 1 ){
This. selectedcount = This. selectedcount + 1;
}
Else {
This. selectedcount = This. selectedcount-1;
}
}
}
);

 

 

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.