私はjqueryで列のコレクションを渡していますが、列の長さを取得しているとき、これは1つの余分なコードを与えています
function manageUsersPage() {
this.data=null;
this.edititem=null;
this.columns = [
[false, 'User Id', 'UserI`enter code here`d', 'readonly', 20, '', null],
[true, 'User Name', 'fullname', 'readonly', 20, '', null],
[true, 'Login Name', 'Login', 'string', 15, 'required', null],
[false, 'Password', 'Password', 'password', 15, '', null],
[false, 'Confirm Password', 'Password', 'password', 15, '', null],
[true, 'User Type', 'UserType', 'select', 0, '', ['Hotel-Admin', 'Chain-Admin', 'User']],
[false, 'Manage Hotels (If Chain-Admin)', 'hotels', 'multiselect', 40, '', null],
[true, 'Email Address', 'Email', 'string', 30, 'custom[email]', null],
[true, 'Reservation Delivery', 'ResvDelivery', 'select', 0, '', ['No Email', 'All', 'Failure', 'Failure, Pending', 'Failure, Validation', 'Failure, Validation, Rejected', 'Failure, Validation,Pnding', 'Validation,Rejected,Failure, Pnding', 'Failure, Validation,Pnding,Success']],
[true, 'RMS Mail Delivery', 'RmsDelivery', 'select', 0, '', ['On', 'Off']],
[false, "First Name", "FirstName", 'string', 20, '', null],
[false, "Middle Name", "MiddleName", 'string', 20, '', null],
[false, "Last Name", "LastName", 'string', 20, '', null],
[false, "Address", "Address", 'text', 40, '', null],
[false, "Comments", "Comments", 'text', 100, '', null],
//[false, "login Status", "Loginstatus", "test", 20, '', null],
[false, 'Mail Delivery', 'RmsDelivery', 'select', 0, '', ['No Email', 'All', 'Failure', 'Failure, Pending', 'Failure, Validation', 'Failure, Validation, Rejected', 'Failure, Validation,Pnding', 'Validation,Rejected,Failure, Pnding', 'Failure, Validation,Pnding,Success']],
];
this.edittable=null;
}
そして私がしようとしているとき
var columns = this.columns, data = this.data;
var html = '<form id=' + this.formid + '>';
html += '<table id=' + this.tableid + ' width=100% class=tableBox>';
html += '<thead><tr>';
for (i = 0; i < columns.length; i++) {
if (!columns[i][0]) continue;
html += '<th>' + columns[i][1] + '</th>';
}
column.length は 17 になり、columns は 16 になります