1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import {createFirstRow, createFirstRowOcc, createRow} from "./createTable.js"
- import {createPagination} from './pagination.js'
- import {createOccRow} from './createTable.js'
- import {createPage} from './createSingleContext.js'
- export let arrayResponse = [];
- export function processData(response){
- console.log(response);
- $("#loader").css("display", "none");
- if(response.length==0){
- alert('No results!')
- }
- else {
- arrayResponse = response;
- var keys = Object.keys(response[0]);
- createFirstRow(keys);
- var ll = response.length;
- for (var i=0; i<ll; i++) {
- let newRow = response[i];
- createRow(i, newRow);
- }
- }
- }
- export function processOccData(response){
- console.log(response);
- $("#loader").css("display", "none");
- if(response.length==0){
- alert('No results!')
- }
- else {
- arrayResponse = response;
- var keys = Object.keys(response[0]);
- createFirstRowOcc(keys);
- var ll = response.length;
- let pags = Math.floor(ll / 10);
- let extraP = ll % 10;
- if (extraP != 0) {
- pags = pags + 1;
- }
- let pp = 9;
- let ref = 1;
- createPagination(pags);
- for (var j=1; j<pags+1; j++) {
- var newDiv = document.createElement('div');
- newDiv.id = "pag_" + j;
- newDiv.className = "page";
- $("#result").append(newDiv)
- }
-
- for (var i=0; i<ll; i++) {
- if (i >= pp) {
- pp = pp + 10;
- ref = ref + 1;
- } else {
- pp = pp;
- }
- let newRow = response[i];
- createOccRow(i, newRow, ref);
- }
- }
- }
- export function processSingleContext(response){
- if(response.length==0){
- alert('No results!')
- }
- else {
- console.log(response);
- createPage(response[0]);
- }
- }
|