How to use tableIndex method in wpt

Best JavaScript code snippet using wpt

ajax_sorted_table.js

Source:ajax_sorted_table.js Github

copy

Full Screen

1 var minimumRows = 3; //Below minimumRows, the table does not display the status/tool bar below it2 var defaultRowsPerPage = 20; //This will change 3 4 var allTables = document.getElementsByTagName('table'); //Get all the tables in this document5 var sortedTables = new Array(); //This global array will hold all the tables that need to have sorting/paging capabilities6 var useAjax = new Array();7 var autoAjax = new Array();8 var rowsPerPage = new Array();9 var tableSize = new Array();10 var ajaxUrl = new Array();11 var noFooter = new Array();12 13 var currentOffset = new Array();14 var currentSort = new Array();15 var currentOrder = new Array();16 var currentOther = new Array();17 var currentFilter = new Array();18 var branchFilter = new Array();19 var jobFilter = new Array();20 var currentBranchFilter = new Array();21 var currentJobFilter = new Array();22 var activeFilter = new Array();23 24 var checkedEntries = new Array(); 25 var progressImg = 'js/ajax_sorted_table/images/progress1.gif';26 27 for (var k = 0; k < allTables.length; k++) { //Walk through all document tables28 if (allTables[k].className.match('sortedTable')) { //Get all tables that have 'sortedTable' as part of their class definition. These will be paging/sorting enabled29 //sortedTables.push(allTables[k]); //Add this table to the sorted tables array30 table = allTables[k]; //For this table, create the sorting table headers 31 init(table, true);32 }33 }34 function init(table, isFirst, idx) {35 var count = 0;36 if (isFirst) {37 sortedTables.push(table);38 tableIndex = sortedTables.length-1;39 } else {40 sortedTables[idx] = table;41 tableIndex = idx;42 }43 if (typeof(other) == 'undefined') {44 other = ''; 45 }46 if (table.getAttribute('other')) {47 other = table.getAttribute('other');48 } 49 50 for (i = 0; i < table.rows[0].cells.length; i++) { //the first table row, table.row[0] should hold the cell headlines.51 if (!table.rows[0].cells[i].className.match('noSort')) { //If a column has the class \"noSort\" defined, make it non-sortable. Furthermore, if the table has only 1 or 2 rows, it is empty so disabled sorting features52 var anchor = document.createElement('a'); //create the link that will be used to sort the table on this field53 anchor.setAttribute('href', 'javascript:void(0)'); //Inactive link54 if (table.rows[0].cells[i].getAttribute('name')) {55 anchor.setAttribute('id', tableIndex + '_' + table.rows[0].cells[i].getAttribute('name')); //The id corresponds to <current table>_<current link>, so that we know which table is sorted, if there are multiple paged tables, and which link was pressed56 }57 anchor.setAttribute('tableIndex', tableIndex);58 anchor.setAttribute('order', 'asc');59 //anchor.style.paddingRight = '15px';60 if (Element.hasClassName(table.rows[0].cells[i], 'centerAlign')) { //For proper alignment, otherwise center-aligned elements display a little to the right. For some strange reason, obj.hasClassName() does not work in IE, and we must use Element.hasclassName() notation61 //anchor.style.paddingLeft = '15px';62 }63 anchor.style.verticalAlign = 'middle';64 anchor.setAttribute('column_name', table.rows[0].cells[i].getAttribute('name'));65 anchor.onclick = function () {eF_js_sortTable(this, other);}; //Add the sorting function to the onclick event66 anchor.innerHTML = table.rows[0].cells[i].innerHTML; //Copy the cells content inside the link67 table.rows[0].cells[i].innerHTML = ''; //Remove the cell content, since it was copied to the link68 table.rows[0].cells[i].appendChild(anchor); //Append the link to the cell 69 if (table.getAttribute('sortBy') && table.getAttribute('sortBy') == i) {70 var sortBy = anchor; //Assign the element that will be initially sorted for71 if (table.getAttribute('order') && table.getAttribute('order') == 'desc') {72 anchor.setAttribute('order', 'desc');73 }74 }75 }76 }77 if (!$('loading_'+table.id)) {78 loadingDiv = new Element('div', {id:'loading_'+table.id}).addClassName('loading');79 loadingDiv.setOpacity(0.9); 80 loadingDiv.insert(new Element('div').insert(new Element('img', {src:'js/ajax_sorted_table/images/progress1.gif'}).setStyle({verticalAlign:'middle'}))81 .insert(new Element('span').setStyle({verticalAlign:'middle'}).update('&nbsp;'+sorted_translations["loadingdata"]))82 .setStyle({top:'50%',left:'45%',position:'absolute'}));83 }84 85 if (isFirst) { 86 87 checkedEntries[tableIndex] = new Array();88 if (getCookie('cookieTableRows')) {89 rowsPerPage[tableIndex] = getCookie('cookieTableRows');90 } else if (table.getAttribute('rowsPerPage')) {91 rowsPerPage[tableIndex] = parseInt(table.getAttribute('rowsPerPage'));92 } else {93 rowsPerPage[tableIndex] = defaultRowsPerPage;94 }95 if (table.getAttribute('useAjax')) {96 document.body.appendChild(loadingDiv);97 loadingDiv.clonePosition(table);98 if (loadingDiv.getDimensions().height == 0 && loadingDiv.getDimensions().width == 0) {99 loadingDiv.setStyle({display:'none'});100 }101 102 useAjax[tableIndex] = true;103 ajaxUrl[tableIndex] = table.getAttribute('url');104 autoAjax[tableIndex] = true;105 if (table.getAttribute('no_auto')) {106 loadingDiv.hide();107 loadingDiv.writeAttribute({loaded:true});108 autoAjax[tableIndex] = false;109 }110 }111 if (table.getAttribute('branchFilter')) {112 branchFilter[tableIndex] = table.getAttribute('branchFilter');113 } else {114 branchFilter[tableIndex] = false; 115 }116 if (table.getAttribute('jobFilter')) {117 jobFilter[tableIndex] = table.getAttribute('jobFilter');118 } else {119 jobFilter[tableIndex] = false; 120 }121 if (table.getAttribute('activeFilter')) {122 activeFilter[tableIndex] = true;123 } else {124 activeFilter[tableIndex] = false; 125 } 126 127 if (table.getAttribute('noFooter') == 'true') {128 noFooter[tableIndex] = true;129 rowsPerPage[tableIndex] = 100000;130 } 131 tableSize[tableIndex] = Math.ceil(table.getAttribute('size') / rowsPerPage[tableIndex]);132 eF_js_pageTable(tableIndex); //Convert this table to paged table.133 if (sortBy && autoAjax[tableIndex]) {134 eF_js_sortTable(sortBy);135 } else if (useAjax[tableIndex] && autoAjax[tableIndex]) {136 eF_js_sortTable(null, other); //Ajax must be initialized some way, and sortBy is a convenient one.137 }138 sortBy = false;139 140 } else {141 tableSize[tableIndex] = Math.ceil(table.getAttribute('size') / rowsPerPage[tableIndex]);142 eF_js_pageTable(tableIndex); //Convert this table to paged table.143 }144 145 }146 function eF_js_redrawPage(tableIndex, draw, other) {147 if ($(tableIndex)) {148 for (var i = 0; i < sortedTables.size(); i++) {149 if (sortedTables[i].id.match(tableIndex)) {150 tableIndex = i;151 }152 } 153 }154 if (other) {155 currentOther[tableIndex] = other;156 }157 if (draw) {158 eF_js_rebuildTable(tableIndex, currentOffset[tableIndex], currentSort[tableIndex], currentOrder[tableIndex], currentOther[tableIndex]); 159 } else {160 eF_js_rebuildTable(tableIndex, currentOffset[tableIndex], currentSort[tableIndex], currentOrder[tableIndex], currentOther[tableIndex], true, true);161 }162 }163 164 function eF_js_rebuildTable(tableIndex, offset, column_name, order, other, noDiv, noRefresh) {165 try {166 if ($(tableIndex)) {167 for (var i = 0; i < sortedTables.size(); i++) {168 if (sortedTables[i].id.match(tableIndex)) {169 tableIndex = i;170 }171 } 172 }173 if (window.onBeforeSortedTable) {174 window.onBeforeSortedTable(sortedTables[tableIndex]);175 }176 //eF_js_getChecked (tableIndex);177 if (!column_name) {178 column_name = '';179 }180 if (!order) {181 order = '';182 }183 currentOffset[tableIndex] = offset;184 currentSort[tableIndex] = column_name;185 currentOrder[tableIndex] = order;186 if (Object.isUndefined(other)) {187 other = '';188 } 189 currentOther[tableIndex] = other;190 var el = document.getElementById(tableIndex+ '_' + column_name);191 url = ajaxUrl[tableIndex]+'ajax='+sortedTables[tableIndex].id+'&limit='+rowsPerPage[tableIndex]+'&offset='+offset+'&sort='+column_name+'&order='+order+'&other='+other;192 if (currentFilter[tableIndex] || currentBranchFilter[tableIndex] || currentJobFilter[tableIndex]) {193 //url = url + '&filter='+(currentFilter[tableIndex])+'||||'+((currentBranchFilter[tableIndex])? (currentBranchFilter[tableIndex]):'')+'||||'+((currentJobFilter[tableIndex])?(currentJobFilter[tableIndex]):'');194 url = url + '&filter='+encodeURIComponent(currentFilter[tableIndex])+'||||'+((currentBranchFilter[tableIndex])? encodeURIComponent(currentBranchFilter[tableIndex]):'')+'||||'+((currentJobFilter[tableIndex])?encodeURIComponent(currentJobFilter[tableIndex]):'');195 }196 var loadingDiv = $('loading_'+sortedTables[tableIndex].id);197 loadingDiv.clonePosition(sortedTables[tableIndex]);198 if (!noDiv && (loadingDiv.getDimensions().height > 0 || loadingDiv.getDimensions().width > 0)) {199 loadingDiv.show();200 }201 new Ajax.Request(url, {202 method:'get',203 asynchronous:true,204 onFailure: function (transport) {205 var tableId = sortedTables[tableIndex].id;206 var spanElement = document.createElement('span');207 spanElement.innerHTML += transport.responseText;208 sortedTables[tableIndex].parentNode.replaceChild(spanElement, sortedTables[tableIndex]);209 loadingDiv.hide();210 loadingDiv.writeAttribute({loaded:true});211 },212 onSuccess: function (transport) {213 if (noRefresh) { return true;}214 var tableId = sortedTables[tableIndex].id;215 var spanElement = document.createElement('span');216 var re2 = new RegExp("<!--ajax:"+tableId+"-->((.*[\n])*)<!--\/ajax:"+tableId+"-->"); //Does not work with smarty {strip} tags!217 var tableText = re2.exec(transport.responseText);218 if (!tableText) {219 var re = new RegExp("<!--ajax:"+tableId+"-->((.*[\r\n\u2028\u2029])*)<!--\/ajax:"+tableId+"-->"); //Does not work with smarty {strip} tags!220 tableText = re.exec(transport.responseText);221 }222 spanElement.innerHTML += tableText[1];223 224 //spanElement.innerHTML += transport.responseText;225 sortedTables[tableIndex].parentNode.replaceChild(spanElement, sortedTables[tableIndex]);226 loadingDiv.hide();227 //loadingDiv.setStyle({width:'0px', height:'0px'});228 loadingDiv.writeAttribute({loaded:true});229 230 init(document.getElementById(tableId), false, tableIndex);231 document.getElementById(tableIndex+'_sortedTable_currentPage').selectedIndex = Math.ceil(currentOffset[tableIndex]/rowsPerPage[tableIndex]);232 sortedTables[tableIndex].style.visibility = 'visible';233 //loadingDiv.clonePosition(sortedTables[tableIndex]);234 if (el) {235 if (currentOrder[tableIndex] == 'desc') { //Set the icons through the class to reflect the order, ascending or descending 236 $(el.id).className = 'sortDescending';237 $(el.id).setAttribute('order', 'asc');238 if ($(el.id).up().select('img').length == 0) {239 $(el.id).up().insert(new Element('img', {src:'themes/default/images/others/transparent.gif'}).addClassName('sprite16').addClassName('sprite16-navigate_down').setStyle({verticalAlign:'middle'}));240 } else {241 $(el.id).up().select('img')[0].src = 'themes/default/images/others/transparent.gif';242 $(el.id).up().select('img')[0].addClassName('sprite16').addClassName('sprite16-navigate_down');243 }244 } else { 245 $(el.id).className = 'sortAscending';246 $(el.id).setAttribute('order', 'desc'); 247 if (currentSort[tableIndex] !== 'null') { // when sortby not set, don't display arrow 248 if ($(el.id).up().select('img').length == 0) {249 $(el.id).up().insert(new Element('img', {src:'themes/default/images/others/transparent.gif'}).addClassName('sprite16').addClassName('sprite16-navigate_up').setStyle({verticalAlign:'middle'}));250 } else { 251 $(el.id).up().select('img')[0].src = 'themes/default/images/others/transparent.gif';252 $(el.id).up().select('img')[0].addClassName('sprite16').addClassName('sprite16-navigate_up');253 }254 }255 }256 }257 258 generateTips();259 repositionFileManager(sortedTables[tableIndex]);260 if (window.onSortedTableComplete) {261 window.onSortedTableComplete();262 }263 if (sortedTables[tableIndex].hasClassName('subSection')) {264 onLoadSubSection(sortedTables[tableIndex]);265 }266 }267 });268 } catch (e) {269 handleException(e);270 }271 }272 273function eF_js_sortTable(el, other) {274 Element.extend(el);275 var column_name = "null";276 if (el) {277 tableIndex = el.getAttribute('tableIndex'); //Get the id of the element278 column_name = el.getAttribute('column_name');279 order = el.getAttribute('order');280 } else {281 column_name = "null";282 order = "desc";283 }284 285 if (useAjax[tableIndex]) {286 if (el) {287 //Element.extend(el).insert(new Element('img', {id: 'img_', src:'js/ajax_sorted_table/images/progress1.gif'}).setStyle({borderWidth:'0px', position:'absolute'}));288 Element.extend(el).addClassName('loadingImg').setStyle({background:'url("'+progressImg+'") center right no-repeat'});289 } 290 eF_js_rebuildTable(tableIndex, 0, column_name, order, other, true);291 } else {292 293 parentTable = sortedTables[tableIndex]; //Get the table object, depending on the array offset that el.getAttribute('tableIndex') represents294 var counter = 0; //counter is used in the search for the clicked column295 for (i = 0; i < parentTable.rows[0].cells.length; i++) { //Traverse through all table header cells296 //if (parentTable.rows[0].childNodes[i].tagName == 'TD' || parentTable.rows[0].childNodes[i].tagName == 'TH') { //filter out any non cell elements that are children of the top table row297 if (el && parentTable.rows[0].cells[i] == el.parentNode) { //If this node is the same as el (the clicked one), hold its index at 'pressed'298 var pressed = counter;299 } else {300 if (parentTable.rows[0].cells[i].getElementsByTagName('A').length > 0){301 parentTable.rows[0].cells[i].getElementsByTagName('A')[0].className = ''; //For every other cell, eliminate its class name, thus making the ascending or descending icon disspear302 }303 }304 counter++;305 //}306 }307 var tableRowIndex = new Array(); //tableRowIndex holds the table rows and their index in the table308 var tableRows = new Array(); //tableRows holds a copy of the table rows309 for (i = 0; i < parentTable.rows.length - 2; i++) {310 if (typeof(parentTable.rows[i+1].cells[pressed]) != 'undefined') { 311 tableRowIndex[i] = new Array(getText(parentTable.rows[i+1].cells[pressed]).toLowerCase(), i);312 } else {313 tableRowIndex[i] = new Array('', i);314 }315 tableRows[i] = parentTable.rows[i+1].cloneNode(true);316 selects_source = parentTable.rows[i+1].getElementsByTagName('select'); //Microsoft IE has a bug, and does not copy selected and checked attributes when cloning! See http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerProgrammingBugs317 selects_target = tableRows[i].getElementsByTagName('select');318 for (var k = 0; k < selects_source.length; k++) {319 selects_target[k].options.selectedIndex = selects_source[k].options.selectedIndex;320 }321 checkboxes_source = parentTable.rows[i+1].getElementsByTagName('input'); //Microsoft IE has a bug, and does not copy selected and checked attributes when cloning! See http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerProgrammingBugs322 checkboxes_target = tableRows[i].getElementsByTagName('input');323 for (var k = 0; k < checkboxes_source.length; k++) {324 if (checkboxes_target[k].type == 'checkbox') {325 checkboxes_target[k].checked = checkboxes_source[k].checked;326 }327 }328 }329 if (tableRowIndex[0][0].match(/^(-?\d\d*)/)) { //If it's a number, use other sorting function 330 tableRowIndex.sort(sortNumber);331 } else {332 tableRowIndex.sort();333 }334 el.up().up().select('img').each(function(s) {if (s.hasClassName('sprite16-navigate_down') || s.hasClassName('sprite16-navigate_up')) {s.remove();}});335 if (parseInt(document.getElementById(tableIndex+'_sortedTable_sortBy').value) == pressed) { //parseInt is needed here, since if inputs[counter].value is empty and pressed is 0, the clause evaluates to true! We need to make sure that if inputs[counter].value is empty is not converted implicitly to 0336 if (el.className == 'sortAscending') { //Set the icons through the class to reflect the order, ascending or descending337 el.className = 'sortDescending';338 if (el.up().select('img').length == 0) {339 el.up().insert(new Element('img', {src:'themes/default/images/others/transparent.gif'}).addClassName('sprite16').addClassName('sprite16-navigate_down').setStyle({verticalAlign:'middle',marginLeft:'6px'}));340 } else {341 //el.up().select('img')[0].src = 'themes/default/images/others/transparent.gif';342 el.up().select('img')[0].removeClassName('sprite16-navigate_down').addClassName('sprite16-navigate_up');343 }344 } else {345 tableRowIndex.reverse(); //If the column clicked is already sorted, we need to reverse the elements order346 el.className = 'sortAscending';347 if (el.up().select('img').length == 0) {348 el.up().insert(new Element('img', {src:'themes/default/images/others/transparent.gif'}).addClassName('sprite16').addClassName('sprite16-navigate_up').setStyle({verticalAlign:'middle',marginLeft:'6px'}));349 } else {350 //el.up().select('img')[0].src = 'themes/default/images/others/transparent.gif';351 el.up().select('img')[0].removeClassName('sprite16-navigate_up').addClassName('sprite16-navigate_down');352 353 }354 }355 } else {356 document.getElementById(tableIndex+'_sortedTable_sortBy').value = pressed; //Set the hidden element value to the current sorted field357 el.className = 'sortDescending'; //Update the sorting icon358 if (el.up().select('img').length == 0) {359 el.insert(new Element('img', {src:'themes/default/images/others/transparent.gif'}).addClassName('sprite16').addClassName('sprite16-navigate_down').setStyle({verticalAlign:'middle',marginLeft:'6px'}));360 } else {361 //el.up().select('img')[0].src = 'themes/default/images/others/transparent.gif';362 el.up().select('img')[0].removeClassName('sprite16-navigate_down').addClassName('sprite16-navigate_up');363 }364 } 365 counter = parentTable.rows.length - 2;366 while (tableRowIndex.length > 0) { //Replace the table rows with the copies corresponding to the sorted order367 val = tableRowIndex.pop();368 parentTable.rows[counter].parentNode.replaceChild(tableRows[val[1]], parentTable.rows[counter]);369 counter--;370 }371 eF_js_refreshPage(el.getAttribute('tableIndex')); //Refresh the current page so that it holds the correct data372 }373 374 }375 376 function eF_js_refreshPage(tableIndex) {377 var parentTable = sortedTables[tableIndex]; //Get the current table378 var page = document.getElementById(tableIndex+'_sortedTable_currentPage').options[document.getElementById(tableIndex+'_sortedTable_currentPage').selectedIndex].value; //Get the current page from the select box379 var count = 0;380 for (var j = 1; j < parentTable.rows.length - 1; j++) { //Update the contents of this page, by hiding each row that should not be part of it381 if (j < page * rowsPerPage[tableIndex] + 1 || j > parseInt(rowsPerPage[tableIndex]) + page * rowsPerPage[tableIndex]) {382 parentTable.rows[j].style.display = 'none';383 } else {384 parentTable.rows[j].style.display = '';385 count++ % 2 ? newClass = 'evenRowColor' : newClass = 'oddRowColor';386 parentTable.rows[j].className = parentTable.rows[j].className.replace(/evenRowColor|oddRowColor/i, newClass);387 }388 }389 }390 function eF_js_changePage(tableIndex, page) {391 var parentTable = sortedTables[tableIndex]; //Get the current table392 if (page == 'next') {393 page = parseInt(document.getElementById(tableIndex+'_sortedTable_currentPage').options[document.getElementById(tableIndex+'_sortedTable_currentPage').selectedIndex].value) + 1; //Get the current page from the select box394 if (page > document.getElementById(tableIndex+'_sortedTable_currentPage').options.length - 1) {395 page = document.getElementById(tableIndex+'_sortedTable_currentPage').options.length - 1;396 }397 } else if (page == 'previous') {398 page = parseInt(document.getElementById(tableIndex+'_sortedTable_currentPage').options[document.getElementById(tableIndex+'_sortedTable_currentPage').selectedIndex].value) - 1; //Get the current page from the select box399 if (page < 0 ) {400 page = 0;401 }402 }403 if (useAjax[tableIndex] && !isNaN(currentOffset[tableIndex])) {404 eF_js_rebuildTable(tableIndex, page * rowsPerPage[tableIndex], currentSort[tableIndex], currentOrder[tableIndex], currentOther[tableIndex]);405 } else {406 for (var j = 1; j < parentTable.rows.length - 1; j++) { //Update the contents of the current page, by hiding each row that should not be part of it407 if (j < page*rowsPerPage[tableIndex] + 1 || j > parseInt(rowsPerPage[tableIndex]) + page * rowsPerPage[tableIndex]) {408 parentTable.rows[j].style.display = 'none';409 } else {410 parentTable.rows[j].style.display = '';411 }412 }413 var startResult = parseInt(page*rowsPerPage[tableIndex]) + 1;414 var endResult = parseInt(rowsPerPage[tableIndex]) + page * rowsPerPage[tableIndex];415 if (endResult > parentTable.rows.length - 2) {416 endResult = parentTable.rows.length - 2;417 }418 //$(tableIndex+'_displaying_results').innerHTML = '<?php echo _DISPLAYINGRESULTS?> '+startResult+'-'+endResult+' <?php echo _OUTOF?> '+(parentTable.rows.length - 2);419 }420 421 $(tableIndex+'_sortedTable_currentPage').selectedIndex = page; 422 423 }424 425 function eF_js_selectAll (el, tableIndex) {426 try {427 var table = sortedTables[tableIndex]; //Get the table to perform paging on428 429 var inputs = table.getElementsByTagName('input'); //Get all the \"input\" elements on the table430 for (var i = 0; i < inputs.length; i++) {431 if (inputs[i].type == 'checkbox') { //for each checkbox, set its \"checked\" state to match the global checkbox432 inputs[i].checked = el.checked;433 // MODULE HCD INTERVENTION FOR APPEARANCES OF HIDDEN BOXES -- The following should leave from here (by mpaltas)434 if (typeof(myform) != 'undefined' && myform == "branch_to_employees") {435 if (document.getElementById("job_selection_row" + i) && document.getElementById("position_select_row" + i)) {436 if (!inputs[i].checked) { //for each job descriptions select, make it appear/disappear437 document.getElementById("job_selection_row" + i).style.visibility = "hidden";438 document.getElementById("position_select_row" + i).style.visibility = "hidden";439 document.getElementById('position_select_row' + i).name = "_"; 440 } else {441 document.getElementById("job_selection_row" + i).style.visibility = "visible";442 document.getElementById("position_select_row" + i).style.visibility = "visible";443 document.getElementById("position_select_row" + i).name = "visible";444 document.getElementById('position_select_row' + i).name = document.getElementById('position_select_row'+i).value + "_" + document.getElementById('job_selection_row'+i).value; 445 }446 }447 }448 if (typeof(myform) != 'undefined' && (myform == "employee_to_skills" || myform == "employees_to_skill" )) {449 skill_id = inputs[i].name;450 spec_text = document.getElementById('spec_skill_'+skill_id);451 if (spec_text) {452 if (!inputs[i].checked) {453 spec_text.style.visibility = "hidden";454 } else {455 spec_text.style.visibility = "visible";456 }457 }458 }459 if (typeof(myform) != 'undefined' && myform == "skills_to_lesson") {460 skill_id = inputs[i].name;461 spec_text = document.getElementById('spec_skill_'+skill_id);462 if (spec_text) {463 if (!inputs[i].checked) {464 spec_text.style.visibility = "hidden";465 } else {466 spec_text.style.visibility = "visible";467 }468 }469 }470 if (typeof(myform) != 'undefined' && myform == "skills_to_course") {471 skill_id = inputs[i].name;472 spec_text = document.getElementById('spec_skill_'+skill_id);473 if (spec_text) {474 if (!inputs[i].checked) {475 spec_text.style.visibility = "hidden";476 } else {477 spec_text.style.visibility = "visible";478 }479 }480 }481 }482 }483 if (window.ajaxPost && !table.getAttribute('nomass')) {484 ajaxPost('', el, sortedTables[tableIndex].id);485 }486 } catch (e) {alert(e);}487 488 }489/*490 function eF_js_getChecked (tableIndex) {491 var table = sortedTables[tableIndex]; //Get the table to perform paging on492 var inputs = table.getElementsByTagName('input'); //Get all the \"input\" elements on the table493 for (var i = 0; i < inputs.length; i++) {494 if (inputs[i].type == 'checkbox') {495 if (inputs[i].checked) {496 checkedEntries[tableIndex][inputs[i].id] = 1;497 } else {498 checkedEntries[tableIndex][inputs[i].id] = 0;499 }500 }501 }502 }503 function eF_js_setChecked (tableIndex) {504 var table = sortedTables[tableIndex]; //Get the table to perform paging on505 var inputs = table.getElementsByTagName('input'); //Get all the \"input\" elements on the table506 for (var i = 0; i < inputs.length; i++) {507 if (inputs[i].type == 'checkbox') {508 if (checkedEntries[tableIndex][inputs[i].id] == 1) {509 inputs[i].checked = 'checked';510 } else if (checkedEntries[tableIndex][inputs[i].id] == 0) {511 inputs[i].checked = '';512 }513 }514 }515 }516*/517 function eF_js_pageTable(tableIndex) {518 var table = sortedTables[tableIndex]; //Get the table to perform paging on519 var checkboxesPositions = new Array(); //This array will hold the columns containing checkboxes, to later implement \"check all\" function520 if (table.rows.length > 1) {521 for (var i = 0; i < table.rows[table.rows.length-1].cells.length; i++) { //Traverse through the cells of the *first* data row and search for checkboxes522 if (table.rows[table.rows.length-1].cells[i].getElementsByTagName('input').length > 0 && table.rows[table.rows.length-1].cells[i].getElementsByTagName('input')[0].type == 'checkbox') {523 checkboxesPositions.push(i); //Put the column numbers to this array524 }525 }526 }527 if (useAjax[tableIndex] && tableSize[tableIndex]) {528 pages = tableSize[tableIndex];529 } else {530 pages = Math.ceil((table.rows.length - 1) / rowsPerPage[tableIndex]); //Calculate the total of pages required531 }532 var td = document.createElement('td'); //Create the table cell element that will be the footer holding all the sorting / paging handles533 if (checkboxesPositions.length > 0) {534 td.colSpan = table.rows[0].cells.length - 1;535 var td_checkbox = document.createElement('td');536 td_checkbox.className = 'sortedTableFooter'; //Assign it its special class537 td_checkbox.style.textAlign = 'center';538 var checkbox = document.createElement('input');539 checkbox.setAttribute('type', 'checkbox');540 //mpaltas541 //checkbox.setAttribute('onclick', 'eF_js_selectAll(this, '+tableIndex+')'); //Only workds in FF, not IE. the code below works in both browsers542 checkbox.onclick = function () {543 if (!useAjax[tableIndex] || confirm(sorted_translations["operationaffectmany"])) {544 eF_js_selectAll(this, tableIndex);545 }546 };547 td_checkbox.appendChild(checkbox);548 } else {549 if (table.rows[0].cells.length) { 550 td.colSpan = table.rows[0].cells.length; //Spread it to span over all columns551 } 552 }553 td.className = 'sortedTableFooter'; //Assign it its special class554//Prototype implementation --not ready yet555// td_checkBox = new Element('td', {colSpan:table.rows[0].cells.length - 1})556// .setStyle({textAlign:'center'})557// .addClassName('sortedTableFooter')558// .insert(new Element('input', {type:'checkbox'}))559// .observe('onclick', function () {if (!useAjax[tableIndex] || confirm('<?php echo _OPERATIONWILLAFFECTMANYAREYOUSURE?>')) eF_js_selectAll(this, tableIndex)});560 var div = document.createElement('div');561 562 var input = document.createElement('input'); //Create a text box that will be used for the filtering function563 input.setAttribute('type', 'text');564 input.setAttribute('id', tableIndex+'_sortedTable_filter'); //Set its id to retrieve it easily565 566 $(input).writeAttribute('id', tableIndex+'_sortedTable_filter');567 //input.setAttribute('size', '10'); //Added by mpaltas **But removed from venakis due to IE incompatibility (sic)** to avoid overlapping - using a new table inside the td might be a better idea568 //input.setAttribute('onkeypress', 'if (event.which == 13) eF_js_filterData('+tableIndex+')');569 570/* Moved to 855 with prototype because of IE8 inconsistency 571 * input.setAttribute('onkeypress', ' var e = e || event;if (event.which == 13 || event.keyCode == 13 || e.which == 13 || e.keyCode == 13) {alert(event.keyCode);eF_js_filterData('+tableIndex+'); return false;}'); //Set an onkeypress event, so that pressing \"enter\" fires the function. We put the return false here, so that if the table is inside a form, enter will not submit it572 573 input.onkeypress = function(e) {574 var e = e || event;575 if (e.which == 13 || e.keyCode == 13) {576 eF_js_filterData(tableIndex); 577 return false;578 }579 }580*/ 581 582 if (currentFilter[tableIndex] || currentBranchFilter[tableIndex] || currentJobFilter[tableIndex]) {583 input.setAttribute("value", (currentFilter[tableIndex]));584 585 if (currentBranchFilter[tableIndex] || currentJobFilter[tableIndex]) {586 div.innerHTML += '<span style = "display:none" id = "'+table.id+'_currentFilter">' + currentFilter[tableIndex]+'||||'+((currentBranchFilter[tableIndex])?currentBranchFilter[tableIndex]:'')+'||||'+((currentJobFilter[tableIndex])?currentJobFilter[tableIndex]:'')+'</span>';587 } else {588 div.innerHTML += '<span style = "display:none" id = "'+table.id+'_currentFilter">' + currentFilter[tableIndex]+'</span>';589 }590 } else {591 input.setAttribute("value", sorted_translations["filter"]+'...');592 //input.onclick = function() {}593 }594 //input.className = 'inputSearchText';595 596 //div.innerHTML += '<span style = "vertical-align:middle">&nbsp;'+sorted_translations["filter"]+':&nbsp;</span>';597 div.appendChild(input); //Append it to the footer cell598 //input.setAttribute('onclick', 'if (this.value.match("'+sorted_translations["filter"]+'...'+'")) this.value = "";'); 599 input.onclick = function() {600 if (this.value.match(sorted_translations["filter"]+'...')) {601 this.value = "";602 }603 }604 if (activeFilter[tableIndex]) {605 if (getCookie('toggle_active') == 1) {606 div.appendChild(new Element('img', {src:'js/ajax_sorted_table/images/trafficlight_green.png', alt:sorted_translations['_SHOWINGONLYACTIVEENTITIES'], title:sorted_translations['_SHOWINGONLYACTIVEENTITIES'], onclick:'toggleActive(this, '+tableIndex+')'}).addClassName('ajaxHandle'));607 } else if (getCookie('toggle_active') == -1) {608 div.appendChild(new Element('img', {src:'js/ajax_sorted_table/images/trafficlight_red.png', alt:sorted_translations['_SHOWINGONLYINACTIVEENTITIES'], title:sorted_translations['_SHOWINGONLYINACTIVEENTITIES'], onclick:'toggleActive(this, '+tableIndex+')'}).addClassName('ajaxHandle'));609 } else {610 div.appendChild(new Element('img', {src:'js/ajax_sorted_table/images/trafficlight_on.png', alt:sorted_translations['_SHOWINGALLENTITIES'], title:sorted_translations['_SHOWINGALLENTITIES'], onclick:'toggleActive(this, '+tableIndex+')'}).addClassName('ajaxHandle'));611 }612 }613/* 614 // Enterprise filters615 if (branchFilter[tableIndex]) {616 var selectBranch = document.createElement('select'); //Create a select element that will hold the rows per page617 var temp = branchFilter[tableIndex].split('||||');618 var elOptNew;619 var i;620 for (i = 0; i < temp.length-1; i = i + 2) {621 elOptNew = document.createElement('option');622 elOptNew.value = temp[i];623 elOptNew.text = temp[i+1];624 try {625 selectBranch.add(elOptNew,null);626 } catch(ex) {627 selectBranch.add(elOptNew); // IE only628 }629 if (currentBranchFilter[tableIndex] && temp[i] == currentBranchFilter[tableIndex]) {630 elOptNew.setAttribute('selected', 'selected');631 } 632 }633 634 selectBranch.setAttribute('class', 'inputSelectMed');635 selectBranch.setAttribute('onchange', 'eF_js_filterData('+tableIndex+'); return false;'); //If we ommit parseInt, then rowsPerPage becomes string. So, if for example rowsPerPage is 10 and we add 5, it becoomes 105 instead of 15636 selectBranch.setAttribute('onfocus', 'if ($(\''+tableIndex+'_sortedTable_filter\').value.match("'+sorted_translations["filter"]+'...'+'")) $(\''+tableIndex+'_sortedTable_filter\').value = "";');637 selectBranch.setAttribute('id', tableIndex+'_sortedTable_branchFilter'); //Set its id so we can retrieve its data easily638 if (currentBranchFilter[tableIndex]) {639 div.innerHTML += '<span style = "display:none" id = "'+table.id+'_currentBranchFilter">'+currentBranchFilter[tableIndex]+'</span>'; 640 }641 div.appendChild(selectBranch);642 }643*/ 644 if (jobFilter[tableIndex]) {645 var selectJob = document.createElement('select'); //Create a select element that will hold the rows per page646 647 var temp = jobFilter[tableIndex].split('||||');648 var elOptNew;649 var i;650 var selectedValueIndex = 0;651 for (i = 0; i < temp.length; i++) {652 elOptNew = document.createElement('option');653 elOptNew.value = temp[i];654 655 elOptNew.text = temp[i];656 try {657 selectJob.add(elOptNew,null);658 } catch(ex) {659 selectJob.add(elOptNew); // IE only660 }661 662 if (currentJobFilter[tableIndex] && temp[i] == currentJobFilter[tableIndex]) {663 selectedValueIndex = i;664 } 665 }666 667 668 selectJob.setAttribute('class', 'inputSelectMed');669 //selectJob.setAttribute('onchange', 'eF_js_filterData('+tableIndex+'); return false;'); //If we ommit parseInt, then rowsPerPage becomes string. So, if for example rowsPerPage is 10 and we add 5, it becoomes 105 instead of 15670 selectJob.onchange = function() {671 eF_js_filterData(tableIndex); 672 return false;673 }674 //selectJob.setAttribute('onfocus', 'if ($(\''+tableIndex+'_sortedTable_filter\').value.match("'+sorted_translations["filter"]+'...'+'")) $(\''+tableIndex+'_sortedTable_filter\').value = "";');675 selectJob.onfocus = function() {676 if ($(tableIndex+'_sortedTable_filter').value.match(sorted_translations["filter"]+'...')) {677 $(tableIndex+'_sortedTable_filter').value = "";678 }679 }680 681 selectJob.setAttribute('id', tableIndex+'_sortedTable_jobFilter'); //Set its id so we can retrieve its data easily 682 if (currentJobFilter[tableIndex]) {683 div.innerHTML += '<span style = "display:none" id = "'+table.id+'_currentJobFilter">'+currentJobFilter[tableIndex]+'</span>'; 684 }685 686 div.appendChild(selectJob);687 selectJob.selectedIndex = selectedValueIndex;688 } 689 690 if (branchFilter[tableIndex]) {691 var textBranch = document.createElement('input');692 textBranch.setAttribute('type', 'text');693 694 textBranch.style.width='300px';695 textBranch.style.color='gray';696 textBranch.value = sorted_translations['_ALLBRANCHES'];697 textBranch.setAttribute('id', 'autocomplete_sortedTable'); //Set its id so we can retrieve its data easily698 //textBranch.setAttribute('onfocus', 'this.value="";if ($(\''+tableIndex+'_sortedTable_filter\').value.match("'+sorted_translations["filter"]+'...'+'")) $(\''+tableIndex+'_sortedTable_filter\').value = "";');699 textBranch.onfocus = function() {700 this.value="";701 $(tableIndex+'_sortedTable_filter').value = "";702 }703 704 if (currentBranchFilter[tableIndex]) {705 div.innerHTML += '<span style = "display:none" id = "'+table.id+'_currentBranchFilter">'+currentBranchFilter[tableIndex]+'</span>'; 706 }707 708 div.appendChild(textBranch);709 710 var hidden_value = document.createElement('input');711 hidden_value.setAttribute('type', 'hidden');712 hidden_value.setAttribute('id', tableIndex+'_sortedTable_branchFilter');713 div.appendChild(hidden_value);714 var div_inner = document.createElement('div');715 div_inner.setAttribute('class', 'autocomplete');716 div_inner.style.textAlign='left';717 div_inner.setAttribute('id', 'autocomplete_branches_table');718 div.appendChild(div_inner);719 720 }721 722 723 div.className = 'sortTablefilter';724 td.appendChild(div);725 if (useAjax[tableIndex]) {726 var startResult = 0;727 var endResult = 0;728 if (currentOffset[tableIndex] === 0) {729 startResult = 1;730 endResult = rowsPerPage[tableIndex]; 731 } else if (currentOffset[tableIndex]) {732 startResult = parseInt(currentOffset[tableIndex]) + 1;733 endResult = parseInt(currentOffset[tableIndex]) + parseInt(rowsPerPage[tableIndex]); 734 } 735 if (endResult > parseInt(table.getAttribute('size'))) {736 endResult = table.getAttribute('size');737 } 738 } 739 740 741 var select_rows = document.createElement('select'); //Create a select element that will hold the rows per page742 rowsPerPageArray = new Array('10', '15', '20', '50', '100', '200', '500');743 for (var i = 0; i < rowsPerPageArray.length; i++) { //Append 10 values, 5,10,15, ..., 45 rows per page744 var option = document.createElement('option');745 option.setAttribute('value', rowsPerPageArray[i]);746 option.innerHTML = rowsPerPageArray[i];747 select_rows.appendChild(option);748 if (rowsPerPage[tableIndex] == rowsPerPageArray[i]) {749 option.setAttribute('selected', 'selected');750 }751 }752 //select_rows.setAttribute('onchange', 'numRows = parseInt(this.options[this.selectedIndex].value);eF_js_changeRowsPerPage('+tableIndex+', numRows)'); //If we ommit parseInt, then rowsPerPage becomes string. So, if for example rowsPerPage is 10 and we add 5, it becoomes 105 instead of 15753 select_rows.onchange = function() {754 numRows = parseInt(this.options[this.selectedIndex].value);755 eF_js_changeRowsPerPage(tableIndex, numRows);756 }757 758 select_rows.setAttribute('id', tableIndex+'_sortedTable_rowsPerPage'); //Set its id so we can retrieve its data easily759 select_rows.style.verticalAlign = 'middle';760 761 var span_rows = document.createElement('span');762 span_rows.style.verticalAlign='middle';763 span_rows.innerHTML = sorted_translations["rowsperpage"]+'&nbsp;';764 765 var input = document.createElement('input'); //Create a hidden element, that holds the current page.766 input.setAttribute('type', 'hidden');767 input.setAttribute('id', tableIndex+'_sortedTable_sortBy');768 td.appendChild(input); //Append it to the footer cell769 if (table.toolsCell) { //If we are repaginating table, then we will replace the previous footer cell with this one770 table.toolsCell.parentNode.replaceChild(td, table.toolsCell);771 } else { //If we are creating pagination for the first time, append this cell to the table772 var tr = document.createElement('tr');773 tr.appendChild(td);774 tr.setAttribute('class', 'defaultRowHeight');775 table.getElementsByTagName('tbody')[0].appendChild(tr);776 if (td_checkbox) {777 tr.appendChild(td_checkbox);778 }779 }780 781 $(tableIndex+'_sortedTable_filter').observe('keypress', keypressHandler);782 function keypressHandler (event){783 var key = event.which || event.keyCode;784 switch (key) {785 default:786 break;787 case Event.KEY_RETURN:788 eF_js_filterData(tableIndex); 789 return false;790 break; 791 }792 }793 794 var select_page = document.createElement('select'); //Create a select element, that lists the pages795 select_page.setAttribute('id', tableIndex+'_sortedTable_currentPage');796 //select_page.setAttribute('onchange', 'eF_js_changePage('+tableIndex+', this.options[this.selectedIndex].value)'); //Set an onchange event, so that changing the value fires a change on the page797 select_page.onchange = function() {798 eF_js_changePage(tableIndex, this.options[this.selectedIndex].value);799 }800 801 for (var i = 0; i < pages; i++) { //Add an option for each page802 var option = document.createElement('option');803 option.setAttribute('value', i);804 option.innerHTML = (1 + i*rowsPerPage[tableIndex])+'-'+Math.min((i + 1)*rowsPerPage[tableIndex], table.getAttribute('size') ? table.getAttribute('size') : table.rows.length-2);805 select_page.appendChild(option);806 }807 select_page.style.verticalAlign = 'middle';808 809 if (!sorted_rtl) {810 var img_left_src = 'navigate_left';811 var img_right_src = 'navigate_right';812 } else {813 var img_left_src = 'navigate_right';814 var img_right_src = 'navigate_left';815 }816 817 var span_results = document.createElement('span');818 span_results.style.verticalAlign = 'middle';819 span_results.innerHTML = '&nbsp;'+sorted_translations["displayingresults"]+'&nbsp;';820 var a_first_page = document.createElement('span');821 a_first_page.style.verticalAlign = 'middle';822 //a_first_page.setAttribute('onclick', 'eF_js_changePage('+tableIndex+',0)');823 a_first_page.onclick = function() {824 eF_js_changePage(tableIndex,0);825 }826 827 a_first_page.innerHTML = '<img src = "js/ajax_sorted_table/images/'+img_left_src+'2.png" alt = "'+sorted_translations["_FIRST"]+'" title = "'+sorted_translations["_FIRST"]+'" class = "handle" />';828 var a_previous_page = document.createElement('span');829 a_previous_page.style.verticalAlign = 'middle';830 //a_previous_page.setAttribute('onclick', 'eF_js_changePage('+tableIndex+',\'previous\')');831 a_previous_page.onclick = function() {832 eF_js_changePage(tableIndex,'previous');833 }834 835 a_previous_page.innerHTML = '<img src = "js/ajax_sorted_table/images/'+img_left_src+'.png" alt = "'+sorted_translations["_PREVIOUS"]+'" title = "'+sorted_translations["_PREVIOUS"]+'" class = "handle" />';836 var span_outof = document.createElement('span');837 span_outof.style.verticalAlign = 'middle';838 span_outof.innerHTML = '&nbsp;'+sorted_translations["outof"]+'&nbsp;' + (table.getAttribute('size') ? table.getAttribute('size') : table.rows.length-2)+'&nbsp;';839 840 var a_next_page = document.createElement('span');841 a_next_page.style.verticalAlign = 'middle';842 //a_next_page.setAttribute('onclick', 'eF_js_changePage('+tableIndex+',\'next\')');843 a_next_page.onclick = function() {844 eF_js_changePage(tableIndex,'next');845 }846 847 a_next_page.innerHTML = '<img src = "js/ajax_sorted_table/images/'+img_right_src+'.png" alt = "'+sorted_translations["_NEXT"]+'" title = "'+sorted_translations["_NEXT"]+'" class = "handle" />';848 var a_last_page = document.createElement('span');849 a_last_page.style.verticalAlign = 'middle';850 //a_last_page.setAttribute('onclick', 'eF_js_changePage('+tableIndex+','+(pages - 1)+')');851 a_last_page.onclick = function() {852 eF_js_changePage(tableIndex,(pages - 1));853 }854 855 a_last_page.innerHTML = '<img src = "js/ajax_sorted_table/images/'+img_right_src+'2.png" alt = "'+sorted_translations["_LAST"]+'" title = "'+sorted_translations["_LAST"]+'" class = "handle" />';856 if (!sorted_rtl) {857 td.appendChild(span_rows);858 td.appendChild(select_rows); //Append it to the footer cell859 td.appendChild(span_results);860 td.appendChild(a_first_page);861 td.appendChild(a_previous_page); 862 td.appendChild(select_page);863 td.appendChild(span_outof);864 td.appendChild(a_next_page);865 td.appendChild(a_last_page);866 } else {867 td.appendChild(span_rows);868 td.appendChild(select_rows); //Append it to the footer cell869 td.appendChild(a_previous_page);870 td.appendChild(a_first_page);871 td.appendChild(span_results);872 td.appendChild(select_page);873 td.appendChild(span_outof);874 td.appendChild(a_next_page);875 td.appendChild(a_last_page);876 // 877 // 878 //879 //880 881 //882 }883 884 885 if (!Object.isUndefined(noFooter[tableIndex]) || ((table.rows.length < minimumRows + 2 || parseInt(table.getAttribute('size')) < minimumRows) && !currentFilter[tableIndex] && !currentOffset[tableIndex] && !currentBranchFilter[tableIndex] && !currentJobFilter[tableIndex] && !activeFilter[tableIndex])) {886 tr.style.display = 'none';887 if (!Object.isUndefined(noFooter[tableIndex])) {888 tr.setAttribute('id', 'noFooterRow'+tableIndex);889 } 890 }891 table.toolsCell = td; //Assign the current cell to a global variable 892 if (branchFilter[tableIndex]) {893 //Changed because of #5138, id autocomplete was twice on page894 new Ajax.Autocompleter('autocomplete_sortedTable', 895 "autocomplete_branches_table", 896 "ask.php?ask_type=branches", {paramName: "preffix", 897 afterUpdateElement : function (t, li) {$(tableIndex+'_sortedTable_branchFilter').value=li.id;eF_js_filterData(tableIndex); return false;}}); 898 }899 900 if (!useAjax[tableIndex]) {901 eF_js_changePage(tableIndex, 0); //Display the first page902 table.style.visibility = 'visible'; //The table is not visible by default (to avoid displaying effects). Make the table visible903 }904// if (tr && table.rows.length <= minimumRows) { //Do not show footer table raw, if table rows are up to minimumRows (10)905// tr.style.display = 'none';906// }907 908 }909 function eF_js_filterData(tableIndex) {910//debugger;911 if (useAjax[tableIndex]) {912 var showing_image = false;913 if ($(tableIndex+'_sortedTable_jobFilter')) {914 Element.extend($(tableIndex+'_sortedTable_jobFilter')).addClassName('loadingImg').setStyle({background:'url("'+progressImg+'") center right no-repeat'});915 916 var jobStr = document.getElementById(tableIndex+'_sortedTable_jobFilter').value;917 currentJobFilter[tableIndex] = jobStr;918 showing_image = true;919 } 920 921 if ($(tableIndex+'_sortedTable_branchFilter')) {922 if (!showing_image) {923 Element.extend($(tableIndex+'_sortedTable_branchFilter')).addClassName('loadingImg').setStyle({background:'url("'+progressImg+'") center right no-repeat'});924 showing_image = true;925 }926 927 var branchStr = document.getElementById(tableIndex+'_sortedTable_branchFilter').value;928 currentBranchFilter[tableIndex] = branchStr;929 } 930 931 if (!showing_image) {932 Element.extend($(tableIndex+'_sortedTable_filter')).addClassName('loadingImg').setStyle({background:'url("'+progressImg+'") center right no-repeat'});933 }934 935 var str = (document.getElementById(tableIndex+'_sortedTable_filter').value); //Get the filter value, from the corresponding text box936 currentFilter[tableIndex] = str;937 currentOffset[tableIndex] = 0;938 939 eF_js_rebuildTable(tableIndex, currentOffset[tableIndex], currentSort[tableIndex], currentOrder[tableIndex], currentOther[tableIndex], true);940 } else {941 942 var table = sortedTables[tableIndex]; //Get the current table943 var str = (document.getElementById(tableIndex+'_sortedTable_filter').value); //Get the filter value, from the corresponding text box944 if (table.filteredRows) { //If there were any previously filtered rows, append them back to the table945 for (var i = 0; i < table.filteredRows.length; i++) {946 table.rows[0].parentNode.insertBefore(table.filteredRows[i], table.rows[table.rows.length-1]); //Append the rows at the bottom of the table947 }948 }949 table.filteredRows = new Array(); //This array will hold the filtered rows950 var i = 0;951 while (i < table.rows.length - 2) {952 keepRow = false;953 j = 0;954 //tds = table.rows[i+1].getElementsByTagName('TD');955 /////Here maybe we can get the whole row text and check against the filter text, instead of checking cells one by one956 re = new RegExp(str, "i");957 while (table.rows[i+1].cells[j] != null && !(keepRow = (table.rows[i+1].cells[j++].innerHTML.toString().stripTags().strip()).match(re))) {} //Check if the current row contains the filter text 958 if (!keepRow) {959 table.filteredRows.push(table.rows[i+1].parentNode.removeChild(table.rows[i+1])); //If the row doesn't contain the filter text, remove it fro mthe table and put it in the filteredRows array960 } else {961 i++;962 }963 }964 newPages = (Math.ceil((table.rows.length - 2) / rowsPerPage[tableIndex])); //Recalculate the number of pages965 var select = document.getElementById(tableIndex+'_sortedTable_currentPage'); //Recreate the pages select box to match the new sum of pages966 for (var i = select.options.length - 1; i >= 0; i--) {967 select.removeChild(select.options[i]);968 }969 for (var i = 0; i < newPages; i++) {970 var option = document.createElement('option');971 option.setAttribute('value', i);972 option.innerHTML = i + 1;973 select.appendChild(option);974 }975 currentFilter[tableIndex] = str;976 eF_js_pageTable(tableIndex);977 document.getElementById(tableIndex+'_sortedTable_filter').value = str;978 979 }980 //Repage the table981 }982function eF_js_changeRowsPerPage(tableIndex, numRows) {983 rowsPerPage[tableIndex] = numRows;984 if (useAjax[tableIndex]) {985 eF_js_rebuildTable(tableIndex, 0, currentSort[tableIndex], currentOrder[tableIndex], currentOther[tableIndex]);986 } else {987 eF_js_pageTable(tableIndex);988 }989 setCookie('cookieTableRows', numRows);990}991//Cross-browser function for getting element text992function getText(control) {993 if (document.all) {994 return control.innerText;995 } else {996 return control.textContent;997 }998}999//Sorting for numbers1000function sortNumber(a, b) {1001 var val1 = parseInt(a[0]);1002 var val2 = parseInt(b[0]);1003 if (isNaN(val1)) {1004 val1 = 0;1005 }1006 if (isNaN(val2)) {1007 val2 = 0;1008 }1009 return val1 - val2;1010}1011//In order to display the loading... div when in tab. onTabDisplay() is called automatically by the tabber library 1012if (typeof(tabberObj) != 'undefined') {1013 tabberObj.prototype.onTabDisplay = function(obj) 1014 {1015 Element.extend(obj.tabber.tabs[obj.index].div);1016 obj.tabber.tabs[obj.index].div.select('table').each(1017 function (s) {1018 if (s.hasClassName('sortedTable') && s.getDimensions().height > 0) {1019 $$('div.loading').each(function (s) {s.hide();}); //Hide all1020 if ($('loading_'+s.id) && $('loading_'+s.id).readAttribute('loaded') !== 'loaded') {1021 $('loading_'+s.id).show().clonePosition(s); //Show this one1022 }1023 } 1024 });1025 };1026}1027function toggleSubSection(el, id, sectionId, trailUrl) {1028 try {1029 Element.extend(el);1030 var sectionTable = $(sectionId);1031 var tr = el.up().up(); //The table row holding the clicked element1032 1033 if (el.hasClassName('sprite16-plus') || el.hasClassName('sprite16-plus2')) {1034 1035 tr.up().select('img.sprite16-minus').each(function (s) {setImageSrc(s, 16, 'plus');});1036 tr.up().select('img.sprite16-minus2').each(function (s) {setImageSrc(s, 16, 'plus2');});1037 el.hasClassName('sprite16-plus') ? setImageSrc(el, 16, 'minus') : setImageSrc(el, 16, 'minus2'); 1038 newTr = new Element('tr', {id:'subsection_row_'+sectionId+id}).insert(new Element('td', {colspan:tr.childElements().length}).insert(sectionTable.show().remove()));1039 tr.insert({after:newTr});1040 1041 sectionTable.writeAttribute({no_auto:0});1042 for (var i = 0; i < sortedTables.size(); i++) {1043 if (sortedTables[i].id.match(sectionId) && ajaxUrl[i]) {1044 ajaxUrl[i] = ajaxUrl[i] + sectionId+'_source=' + id + '&' + trailUrl + '&';1045 eF_js_rebuildTable(i, 0);1046 }1047 } 1048 } else { 1049 onCloseSubSection(sectionTable);1050 el.hasClassName('sprite16-minus') ? setImageSrc(el, 16, 'plus') : setImageSrc(el, 16, 'plus2');1051 document.body.insert({after:sectionTable.hide().remove()});1052 $('subsection_row_'+sectionId+id).remove();1053 } 1054 } catch (e) {alert(e);}1055}1056function onCloseSubSection(table) {1057 containers = findContainers(table);1058 activeRows = findActiveRows(table);1059 containers[0].select('tr').each(function (s) {1060 enableRow(s);1061 });1062 activeRows.each(function (s) {1063 enableRow(s.previous());1064 enableRow(s); 1065 });1066 1067}1068function onLoadSubSection(table) {1069 try {1070 containers = findContainers(table);1071 activeRows = findActiveRows(table);1072 1073 containers.each( function (c) {1074 c.select('tr').each(function (s) {1075 enableRow(s);1076 });1077 c.select('tr').each(function (s) {1078 if (s.visible()) {1079 disableRow(s);1080 };1081 });1082 });1083 activeRows.each(function (a) {1084 enableRow(a);1085 });1086 if (activeRows[0]) {1087 enableRow(activeRows[0].previous());1088 }1089 table.select('tr').each(function (s) {1090 enableRow(s);1091 });1092 } catch (e) {1093 handleException(e);1094 }1095}1096function findActiveRows(el) {1097 var activeRows = new Array();1098 el.ancestors().each(function (s) {1099 if (s.id.match('subsection_row')) {1100 activeRows.push(s);1101 }}); 1102 return activeRows; 1103}1104function findContainers(el) {1105 var containers = new Array();1106 el.ancestors().each(function (s) {1107 if (s.hasClassName('sortedTable')) {1108 containers.push(s);1109 }}); 1110 //containers.reverse();1111 return containers;1112}1113function isDisabledRow(tr) {1114 if ($('loading_'+tr.identify())) {1115 return true;1116 } else {1117 return false;1118 }1119}1120function disableRow(tr) {1121 var loadingDiv = new Element('div', {id:'loading_'+tr.identify()}).addClassName('loading');//.setStyle({border:'2px solid green'});1122 loadingDiv.setOpacity(0.4); 1123 document.body.appendChild(loadingDiv);1124 //Unfortunately, IE doesn't like clonePosition(tr), so we have to go with this solution 1125 loadingDiv.setStyle({width:tr.getDimensions().width+'px', 1126 height:tr.getDimensions().height+'px', 1127 left:tr.down().cumulativeOffset().left+'px',1128 top:tr.down().cumulativeOffset().top+'px'}); 1129}1130function enableRow(tr) {1131 if ($('loading_'+tr.identify())) {1132 $('loading_'+tr.identify()).remove();1133 }1134 1135}1136function augmentUrl(table_id) {1137 augmentedUrl = '';1138 tables = sortedTables.size();1139 for (var i = 0; i < tables; i++) {1140 if (sortedTables[i].id.match(table_id) && ajaxUrl[i]) {1141 tableIndex = i;1142 augmentedUrl = ajaxUrl[tableIndex]+'ajax='+sortedTables[tableIndex].id+'&limit='+rowsPerPage[tableIndex]+'&offset='+currentOffset[tableIndex]+'&sort='+currentSort[tableIndex]+'&order='+currentOrder[tableIndex]+'&other='+currentOther[tableIndex];1143 }1144 } 1145 return augmentedUrl;1146}1147function findSortedTableIndex(name) {1148 tables = sortedTables.size();1149 for (var i = 0; i < tables; i++) {1150 if (sortedTables[i].id.match(name)) {1151 return i;1152 }1153 } 1154 1155}1156function toggleActive(el, tableIndex) {1157 Element.extend(el);1158 if (getCookie('toggle_active') == 1) {1159 el.writeAttribute({src:'js/ajax_sorted_table/images/trafficlight_red.png'});1160 setCookie('toggle_active', -1);1161 } else if (getCookie('toggle_active') == -1) {1162 el.writeAttribute({src:'js/ajax_sorted_table/images/trafficlight_on.png'});1163 setCookie('toggle_active', 0);1164 } else {1165 el.writeAttribute({src:'js/ajax_sorted_table/images/trafficlight_green.png'});1166 setCookie('toggle_active', 1);1167 }1168 eF_js_rebuildTable(tableIndex, 0, 'null', 'desc');1169}1170function repositionFileManager(table) {1171 if (table.id == 'filesTable') {1172 var heightValue;1173 if (table.getDimensions().height != 0) {1174 heightValue = parseInt(table.getDimensions().height+50);1175 } else {1176 heightValue = 0;1177 }1178 $('filemanager_cell').setStyle({width:table.getDimensions().width+'px', height:heightValue+'px', verticalAlign:'top'});1179 if (typeof(ready_to_set_position) != 'undefined') {1180 $('filemanager_div').absolutize().clonePosition($('filemanager_cell'));1181 }1182 } 1183}1184if (typeof(readCookieForSortedTablePreset) != 'undefined' && readCookie(readCookieForSortedTablePreset)) {1185 var sort_id = readCookie(readCookieForSortedTablePreset).split('--')[0]; 1186 var sort_order = readCookie(readCookieForSortedTablePreset).split('--')[1]; //sort order1187 if ($(sort_id)) {1188 if (sort_order == 'asc') {1189 eF_js_sortTable($(sort_id));1190 eF_js_sortTable($(sort_id));1191 } else {1192 eF_js_sortTable($(sort_id));1193 }1194 if (window.resetFormRows) {1195 resetFormRows($(sort_id).up());1196 }1197 }...

Full Screen

Full Screen

diagram.js

Source:diagram.js Github

copy

Full Screen

1export default {2 namespaced: true,3 state: {4 name: "My Diagram",5 tables: [],6 scale: 1.07 },8 mutations: {9 name: (state, name) => {10 state.name = name;11 },12 addTable: (state, { tableId, table }) => {13 state.tables.push({14 id: tableId,15 name: table?.name || "",16 description: table?.description || "",17 engine: table?.engine || "",18 columns: [],19 indexes: [],20 foreignKeys: []21 });22 },23 tableName: (state, { tableIndex, name }) => {24 state.tables[tableIndex].name = name;25 },26 tableDescription: (state, { tableIndex, description }) => {27 state.tables[tableIndex].description = description;28 },29 tableEngine: (state, { tableIndex, engine }) => {30 state.tables[tableIndex].engine = engine;31 },32 addTableColumn: (state, { tableIndex, column }) => {33 state.tables[tableIndex].columns.push({34 name: column?.name || "",35 dataType: column?.dataType || "",36 defaultExpression: column?.defaultExpression || "",37 PK: column?.PK || false,38 AI: column?.AI || false,39 NN: column?.NN || false,40 UQ: column?.UQ || false,41 UN: column?.UN || false,42 ZF: column?.ZF || false,43 B: column?.B || false,44 FK: column?.FK || null45 });46 },47 tableColumnName: (state, { tableIndex, columnIndex, name }) => {48 state.tables[tableIndex].columns[columnIndex].name = name;49 },50 tableColumnDataType: (state, { tableIndex, columnIndex, dataType }) => {51 state.tables[tableIndex].columns[columnIndex].name = dataType;52 },53 tableColumnDefaultExpression: (54 state,55 { tableIndex, columnIndex, defaultExpression }56 ) => {57 state.tables[tableIndex].columns[columnIndex].name = defaultExpression;58 },59 tableColumnPrimaryKey: (state, { tableIndex, columnIndex, PK }) => {60 state.tables[tableIndex].columns[columnIndex].PK = Boolean(PK);61 },62 tableColumnAutoIncrement: (state, { tableIndex, columnIndex, AI }) => {63 state.tables[tableIndex].columns[columnIndex].AI = Boolean(AI);64 },65 tableColumnNotNull: (state, { tableIndex, columnIndex, NN }) => {66 state.tables[tableIndex].columns[columnIndex].NN = Boolean(NN);67 },68 tableColumnUnique: (state, { tableIndex, columnIndex, UQ }) => {69 state.tables[tableIndex].columns[columnIndex].UQ = Boolean(UQ);70 },71 tableColumnUnsigned: (state, { tableIndex, columnIndex, UN }) => {72 state.tables[tableIndex].columns[columnIndex].UN = Boolean(UN);73 },74 tableColumnZeroFilled: (state, { tableIndex, columnIndex, ZF }) => {75 state.tables[tableIndex].columns[columnIndex].ZF = Boolean(ZF);76 },77 tableColumnBinary: (state, { tableIndex, columnIndex, B }) => {78 state.tables[tableIndex].columns[columnIndex].B = Boolean(B);79 },80 tableColumnForeignKey: (state, { tableIndex, columnIndex, FK }) => {81 state.tables[tableIndex].columns[columnIndex].FK = FK;82 },83 scale: (state, scale) => {84 if (scale > 1) {85 scale = 1.0;86 } else if (scale < 0.1) {87 scale = 0.1;88 }89 state.scale = scale;90 },91 deleteTable: (state, tableIndex) => {92 delete state.tables[tableIndex];93 },94 deleteTableColumn: (state, { tableIndex, columnIndex }) => {95 state.tables[tableIndex].columns.splice(columnIndex, 1);96 },97 columns: (state, { tableIndex, columns }) => {98 state.tables[tableIndex].columns = columns;99 }100 },101 actions: {102 addTable({ state, commit }, tableId) {103 commit("addTable", {104 tableId,105 table: {106 name: "table_name"107 }108 });109 let tableIndex = state.tables.length - 1;110 commit("addTableColumn", {111 tableIndex,112 column: {113 name: "id",114 dataType: "INT(11)",115 PK: true,116 AI: true117 }118 });119 commit("addTableColumn", {120 tableIndex,121 column: {122 name: "status",123 dataType: "ENUM('draft', 'published')",124 defaultExpression: "'draft'",125 NN: true126 }127 });128 commit("addTableColumn", {129 tableIndex,130 column: {131 name: "deleted_at",132 dataType: "DATETIME"133 }134 });135 commit("addTableColumn", {136 tableIndex,137 column: {138 name: "updated_at",139 dataType: "DATETIME"140 }141 });142 commit("addTableColumn", {143 tableIndex,144 column: {145 name: "created_at",146 dataType: "TIMESTAMP",147 defaultExpression: "CURRENT_TIMESTAMP",148 NN: true149 }150 });151 },152 updateTable({ commit }, { tableIndex, table }) {153 commit("tableName", { tableIndex, name: table?.name });154 commit("tableDescription", {155 tableIndex,156 description: table?.description157 });158 commit("tableEngine", { tableIndex, engine: table?.engine });159 },160 addTableColumn({ state, commit }, tableIndex) {161 commit("addTableColumn", {162 tableIndex,163 column: {164 name: "row_" + (state.tables[tableIndex].columns.length + 1)165 }166 });167 },168 updateTableColumn({ commit }, { tableIndex, columnIndex, column }) {169 commit("tableColumnName", {170 tableIndex,171 columnIndex,172 name: column?.name173 });174 commit("tableColumnDataType", {175 tableIndex,176 columnIndex,177 dataType: column?.dataType178 });179 commit("tableColumnDefaultExpression", {180 tableIndex,181 columnIndex,182 defaultExpression: column?.defaultExpression183 });184 commit("tableColumnPrimaryKey", {185 tableIndex,186 columnIndex,187 PK: column?.PK188 });189 commit("tableColumnAutoIncrement", {190 tableIndex,191 columnIndex,192 AI: column?.AI193 });194 commit("tableColumnNotNull", { tableIndex, columnIndex, NN: column?.NN });195 commit("tableColumnUnique", { tableIndex, columnIndex, UQ: column?.UQ });196 commit("tableColumnUnsigned", {197 tableIndex,198 columnIndex,199 UN: column?.UN200 });201 commit("tableColumnZeroFilled", {202 tableIndex,203 columnIndex,204 ZF: column?.ZF205 });206 commit("tableColumnBinary", { tableIndex, columnIndex, B: column?.B });207 commit("tableColumnForeignKey", {208 tableIndex,209 columnIndex,210 FK: column?.FK211 });212 },213 zoomIn({ state, commit }) {214 commit("scale", state.scale + 0.1);215 },216 zoomOut({ state, commit }) {217 commit("scale", state.scale - 0.1);218 },219 deleteTable({ commit }, tableIndex) {220 commit("deleteTable", tableIndex);221 },222 deleteTableColumn({ commit }, { tableIndex, columnIndex }) {223 commit("deleteTableColumn", { tableIndex, columnIndex });224 },225 assignTableColumnsOrder({ commit }, { tableIndex, columns }) {226 commit("columns", { tableIndex, columns });227 }228 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1// production2var socket = io.connect(window.location.hostname);3// local testing4//var socket = io.connect('/');5socket.on("connect", () => {6 console.log("connect: this socket ID = " + socket.id);7});8// reload all the times and buttons whenever the page is fully loaded9$(window).on('load', function() {10 var x = window.performance.timing.domContentLoadedEventEnd- window.performance.timing.navigationStart + "ms";11 console.log("page loaded in " + x);12 socket.emit('add_data');13})14// submit new table item without reload15$('#addNameForm').submit(function(e) {16 e.preventDefault(); // prevents page reloading17 socket.emit('new_name', $('#nameBox').val());18 $('#nameBox').val('');19 return false;20});21// append the new name22socket.on('new_name', function(tableIndex, data) {23 $('#tableBody').append($("<tr>").html(data)); // append data to table24 $('#tableBody tr:last').prop("id", "row" + tableIndex); // append row# id25 // hide check-in button26 $("#checkInBtn" + tableIndex).hide();27 // click listener for remove button28 $(document).on("click", "#remove" + tableIndex, function(e) {29 if (confirm("Are you sure you want to remove " + $("#row" + tableIndex).children().first().html() + "?")) {30 // emit the id of the row31 e.preventDefault();32 socket.emit('remove_name', tableIndex, $("#row" + tableIndex).children().first().html());33 }34 })35 // click listener for check-out button36 setBtnListener("checkOutBtn" + tableIndex, tableIndex, 'out');37 // click listener for check-in button38 setBtnListener("checkInBtn" + tableIndex, tableIndex, 'in');39});40// update a name41socket.on('update_name', function(tableIndex, name) {42 $("#row" + tableIndex).children().first().html(name);43})44// add data45socket.on('add_data', function (tableIndex, tL, tB) {46 // click listener for remove47 $(document).on("click", "#remove" + tableIndex, function(e) {48 if (confirm("Are you sure you want to remove " + $("#row" + tableIndex).children().first().html() + "?")) {49 // emit the id of the row50 e.preventDefault();51 socket.emit('remove_name', tableIndex, $("#row" + tableIndex).children().first().html());52 }53 })54 // add focusout listener for name field55 $("#row" + tableIndex).children().first().on('focusout', function(e) {56 e.preventDefault();57 socket.emit('update_name', tableIndex, $(this).html());58 });59 if (tL !== "") {60 if (tB === "") { // on the water61 $("#checkOutBtn" + tableIndex).before(tL);62 $("#checkOutBtn" + tableIndex).remove();63 $("#checkOutCell" + tableIndex).prop("contenteditable", "true"); // make time editable64 // focusout listener for checkout time65 $("#checkOutCell" + tableIndex).on('focusout', function(e) {66 e.preventDefault();67 socket.emit('check_out_update', tableIndex, $(this).html(), $(this).prev().html());68 });69 $("#checkInBtn" + tableIndex).show();70 setBtnListener("checkInBtn" + tableIndex, tableIndex, 'in');71 } else { // off the water72 $("#checkOutBtn" + tableIndex).before(tL);73 $("#checkOutBtn" + tableIndex).remove();74 $("#checkInBtn" + tableIndex).before(tB);75 $("#checkInBtn" + tableIndex).remove();76 $("#checkInCell" + tableIndex).prop("contenteditable", "true"); // make time editable77 $("#checkOutCell" + tableIndex).prop("contenteditable", "true"); // make time editable78 $("#checkOutCell" + tableIndex).on('focusout', function(e) {79 e.preventDefault();80 socket.emit('check_out_update', tableIndex, $(this).html(), $(this).prev().html());81 });82 // Doesn't work83 $("#checkInCell" + tableIndex).on('focusout', function(e) {84 e.preventDefault();85 socket.emit('check_in_update', tableIndex, $(this).html(), $(this).prev().prev().html());86 });87 }88 } else { // not yet on water89 $("#checkInBtn" + tableIndex).hide();90 setBtnListener("checkOutBtn" + tableIndex, tableIndex, 'out');91 setBtnListener("checkInBtn" + tableIndex, tableIndex, 'in');92 }93})94// remove a name95socket.on('remove_name', function(tableIndex) {96 $("#row" + tableIndex).remove();97});98// check out99socket.on('check_out', function(tableIndex, time) {100 $("#checkOutBtn" + tableIndex).before(time); // add check-out time101 $("#checkOutBtn" + tableIndex).remove(); // hide the button102 $("#checkOutCell" + tableIndex).prop("contenteditable", "true"); // make time editable103 $("#checkOutCell" + tableIndex).on('focusout', function(e) {104 e.preventDefault();105 socket.emit('check_out_update', tableIndex, $(this).html(), $(this).prev().html());106 });107 $("#checkInBtn" + tableIndex).show(); // show check-in button108});109socket.on('check_out_update', function(tableIndex, time) {110 $("#checkOutCell" + tableIndex).html(time);111})112// check in113socket.on('check_in', function(tableIndex, time) {114 $("#checkInBtn" + tableIndex).before(time); // add check-in time115 $("#checkInBtn" + tableIndex).remove(); // hide the button116 $("#checkInCell" + tableIndex).prop("contenteditable", "true"); // make time editable117 $("#checkInCell" + tableIndex).on('focusout', function(e) {118 e.preventDefault();119 socket.emit('check_in_update', tableIndex, $(this).html(), $(this).prev().html());120 });121});122socket.on('check_in_update', function(tableIndex, time) {123 $("#checkInCell" + tableIndex).html(time);124})125// set button listener (for code readability)126function setBtnListener(id, tableIndex, inout) {127 $(document).on("click", "#" + id, function(e) {128 // get current time129 let today = new Date();130 let mins = today.getMinutes();131 if (mins.toString().length === 1)132 mins = "0" + mins;133 let time = today.getHours() + ":" + mins;134 // emit the id of the check-out button, current time, and name135 e.preventDefault();136 socket.emit('check_' + inout, tableIndex, time, $("#row" + tableIndex).children().first().html());137 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptables = require('wptables');2var fs = require('fs');3wptables.tableIndex(url, function(err, tableIndex) {4 if (err) {5 console.log(err);6 } else {7 console.log(tableIndex);8 fs.writeFile('tableIndex.json', JSON.stringify(tableIndex), function(err) {9 if (err) {10 console.log(err);11 }12 });13 }14});15## tableData(url, tableIndex, callback)16var wptables = require('wptables');17var fs = require('fs');18var tableIndex = require('./tableIndex.json');19wptables.tableData(url, tableIndex, function(err, tableData) {20 if (err) {21 console.log(err);22 } else {23 console.log(tableData);24 fs.writeFile('tableData.json', JSON.stringify(tableData), function(err) {25 if (err) {26 console.log(err);27 }28 });29 }30});31The MIT License (MIT)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptable = require("wptable");2var table = new wptable.Table();3table.addCol("col1");4table.addCol("col2");5table.addRow(["a", "b"]);6table.addRow(["c", "d"]);7table.addRow(["e", "f"]);8table.addRow(["g", "h"]);9table.addRow(["i", "j"]);10table.addRow(["k", "l"]);11table.addRow(["m", "n"]);12table.addRow(["o", "p"]);13table.addRow(["q", "r"]);14table.addRow(["s", "t"]);15table.addRow(["u", "v"]);16table.addRow(["w", "x"]);17table.addRow(["y", "z"]);18console.log(table.tableIndex("col1", "a"));19console.log(table.tableIndex("col1", "b"));20console.log(table.tableIndex("col1", "c"));21console.log(table.tableIndex("col1", "d"));22console.log(table.tableIndex("col1", "e"));23console.log(table.tableIndex("col1", "f"));24console.log(table.tableIndex("col1", "g"));25console.log(table.tableIndex("col1", "h"));26console.log(table.tableIndex("col1", "i"));27console.log(table.tableIndex("col1", "j"));28console.log(table.tableIndex("col1", "k"));29console.log(table.tableIndex("col1", "l"));30console.log(table.tableIndex("col1", "m"));31console.log(table.tableIndex("col1", "n"));32console.log(table.tableIndex("col1", "o"));33console.log(table.tableIndex("col1", "p"));34console.log(table.tableIndex("col1", "q"));35console.log(table.tableIndex("col1", "r"));36console.log(table.tableIndex("col1", "s"));37console.log(table.tableIndex("col1", "t"));38console.log(table.tableIndex("col1", "u"));39console.log(table.tableIndex("col1", "v"));40console.log(table.tableIndex("col1", "w"));41console.log(table.tableIndex("col1", "x"));42console.log(table.tableIndex("col1", "y"));43console.log(table.tableIndex("col1", "z"));

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptable = require('wptable');2var table = new wptable.Table();3table.addHeader('Name');4table.addHeader('Age');5table.addHeader('Location');6table.addRow(['John', 30, 'London']);7table.addRow(['Jane', 20, 'Paris']);8table.addRow(['Bob', 40, 'New York']);9### tableIndex(row, column)10var wptable = require('wptable');11var table = new wptable.Table();12table.addHeader('Name');13table.addHeader('Age');14table.addHeader('Location');15table.addRow(['John', 30, 'London']);16table.addRow(['Jane', 20, 'Paris']);17table.addRow(['Bob', 40, 'New York']);18### tableRowIndex(row)19var wptable = require('wptable');20var table = new wptable.Table();21table.addHeader('Name');22table.addHeader('Age');23table.addHeader('Location');24table.addRow(['John', 30, 'London']);25table.addRow(['Jane', 20, 'Paris']);26table.addRow(['Bob', 40, 'New York']);27### tableColumnIndex(column)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptable = require('./wptable.js');2var table = new wptable();3var tableIndex = table.tableIndex;4var tableData = table.tableData;5var tableData1 = table.tableData1;6var tableData2 = table.tableData2;7var tableData3 = table.tableData3;8var tableData4 = table.tableData4;9var tableData5 = table.tableData5;10var tableData6 = table.tableData6;11var tableData7 = table.tableData7;12var tableData8 = table.tableData8;13var tableData9 = table.tableData9;14var tableData10 = table.tableData10;15var tableData11 = table.tableData11;16var tableData12 = table.tableData12;17var tableData13 = table.tableData13;18var tableData14 = table.tableData14;19var tableData15 = table.tableData15;20var tableData16 = table.tableData16;21var tableData17 = table.tableData17;22var tableData18 = table.tableData18;23var tableData19 = table.tableData19;24var tableData20 = table.tableData20;25var tableData21 = table.tableData21;26var tableData22 = table.tableData22;27var tableData23 = table.tableData23;28var tableData24 = table.tableData24;29var tableData25 = table.tableData25;30var tableData26 = table.tableData26;31var tableData27 = table.tableData27;32var tableData28 = table.tableData28;33var tableData29 = table.tableData29;34var tableData30 = table.tableData30;35var tableData31 = table.tableData31;36var tableData32 = table.tableData32;37var tableData33 = table.tableData33;38var tableData34 = table.tableData34;39var tableData35 = table.tableData35;40var tableData36 = table.tableData36;41var tableData37 = table.tableData37;42var tableData38 = table.tableData38;43var tableData39 = table.tableData39;44var tableData40 = table.tableData40;45var tableData41 = table.tableData41;46var tableData42 = table.tableData42;47var tableData43 = table.tableData43;48var tableData44 = table.tableData44;49var tableData45 = table.tableData45;50var tableData46 = table.tableData46;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful