function loadtable() {
  var errorTrace = -1;
  var loadUpdate = 10000;
  var firstPartialLoad = true;
  var chrNum = 0;
  var numRecords = 0;
  var initialRowDisplay = 10;

  function onLoadPartial() {
    if( firstPartialLoad ) {
      firstPartialLoad = false;
      var numDataRows = (numRecords < initialRowDisplay) ? numRecords : initialRowDisplay;
      $("#SIDAC-grid").css('height',(numDataRows*25+25)+'px');
    }
    dataView.setItems(data);
    grid.resizeCanvas();
    grid.render();
  }

  function onLoadSuccess() {
    onLoadPartial();
    $('#SIDAC-message').html('');
  }

  function onLoadError() {
    if( errorTrace <= 1 ) {
      disableTitleBar = true;
      $('#SIDAC-grid').hide();
      $('#SIDAC-titlebar').css("border","1px solid grey");
      $('#SIDAC-collapseGrid').attr('class','ui-icon ui-icon-alert');
      $('#SIDAC-collapseGrid').attr("title","Failed to load data.");
      $('.grid-footnote').html('');
    }
    if( errorTrace < 0 ) {
      alert("Could open Allele Coverage table data file\n'"+dataFile+"'.");
    } else {
      alert("An error occurred loading Allele Coverage data from file\n'"+dataFile+"' at line "+errorTrace);
    }
    $('#SIDAC-message').append('<span style="color:red;font-style:normal">ERROR</span>');
  }

  $('#SIDAC-message').html('Loading...');
  if( dataFile == null || dataFile == undefined || dataFile == "" ) {
    return onLoadError();
  }

  $.get(dataFile, function(mem) {
    var lines = mem.split("\n");
    $.each(lines, function(n,row) {
      errorTrace = n;
      var fields = $.trim(row).split('\t');
      var chr = fields[0];
      if( chr == '' ) return true; // continue
      if( n > 0 ) {
        data[numRecords] = {
          id : Number(numRecords),
          chrom : chr,
          position : Number(fields[1]),
          targetid : fields[2],
          hotspotid : fields[3],
          call : fields[4],
          reference : fields[5],
          allelefreq : Number(fields[6]),
          coverage : Number(fields[7]),
          cov_a : Number(fields[8]),
          cov_c : Number(fields[9]),
          cov_g : Number(fields[10]),
          cov_t : Number(fields[11]),
          cov_d : Number(fields[12]),
          cov_i : Number(fields[13]),
          cov_f : Number(fields[14]),
          cov_r : Number(fields[15])
        };
        // record unique identifies and order of chromosomes from source
        if( selectAppendUnique('#SIDAC-selectChrom',chr,chr) ) { chrMap[chr] = chrNum++; }
        ++numRecords;
        if( loadUpdate > 0 && numRecords % loadUpdate == 0 ) onLoadPartial();
      }
    });
  }).success(onLoadSuccess).error(onLoadError);
}
// - dataView, grid, columns, data and chrMap[] all defined above
dataView, grid, columns, data and chrMap[] all defined above
dataView grid columns data and chrMap [] all defined above
function loadtable() {
  var errorTrace = -1;
  var loadUpdate = 10000;
  var firstPartialLoad = true;
  var chrNum = 0;
  var numRecords = 0;
  var initialRowDisplay = 10;
  function onLoadPartial() {
    if( firstPartialLoad ) {
      firstPartialLoad = false;
      var numDataRows = (numRecords < initialRowDisplay) ? numRecords : initialRowDisplay;
      $("#SIDAC-grid").css('height',(numDataRows*25+25)+'px');
    }
    dataView.setItems(data);
    grid.resizeCanvas();
    grid.render();
  }
  function onLoadSuccess() {
    onLoadPartial();
    $('#SIDAC-message').html('');
  }
  function onLoadError() {
    if( errorTrace <= 1 ) {
      disableTitleBar = true;
      $('#SIDAC-grid').hide();
      $('#SIDAC-titlebar').css("border","1px solid grey");
      $('#SIDAC-collapseGrid').attr('class','ui-icon ui-icon-alert');
      $('#SIDAC-collapseGrid').attr("title","Failed to load data.");
      $('.grid-footnote').html('');
    }
    if( errorTrace < 0 ) {
      alert("Could open Allele Coverage table data file\n'"+dataFile+"'.");
    } else {
      alert("An error occurred loading Allele Coverage data from file\n'"+dataFile+"' at line "+errorTrace);
    }
    $('#SIDAC-message').append('<span style="color:red;font-style:normal">ERROR</span>');
  }
  $('#SIDAC-message').html('Loading...');
  if( dataFile == null || dataFile == undefined || dataFile == "" ) {
    return onLoadError();
  }
  $.get(dataFile, function(mem) {
    var lines = mem.split("\n");
    $.each(lines, function(n,row) {
      errorTrace = n;
      var fields = $.trim(row).split('\t');
      var chr = fields[0];
      if( chr == '' ) return true; 
      if( n > 0 ) {
        data[numRecords] = {
          id : Number(numRecords),
          chrom : chr,
          position : Number(fields[1]),
          targetid : fields[2],
          hotspotid : fields[3],
          call : fields[4],
          reference : fields[5],
          allelefreq : Number(fields[6]),
          coverage : Number(fields[7]),
          cov_a : Number(fields[8]),
          cov_c : Number(fields[9]),
          cov_g : Number(fields[10]),
          cov_t : Number(fields[11]),
          cov_d : Number(fields[12]),
          cov_i : Number(fields[13]),
          cov_f : Number(fields[14]),
          cov_r : Number(fields[15])
        };
        if( selectAppendUnique('#SIDAC-selectChrom',chr,chr) ) { chrMap[chr] = chrNum++; }
        ++numRecords;
        if( loadUpdate > 0 && numRecords % loadUpdate == 0 ) onLoadPartial();
      }
    });
  }).success(onLoadSuccess).error(onLoadError);
}
function loadtable ( ) { var errorTrace = - 1 ; var loadUpdate = 10000 ; var firstPartialLoad = true ; var chrNum = 0 ; var numRecords = 0 ; var initialRowDisplay = 10 ; function onLoadPartial ( ) { if ( firstPartialLoad ) { firstPartialLoad = false ; var numDataRows = ( numRecords < initialRowDisplay ) ? numRecords : initialRowDisplay ; $ ( "#SIDAC-grid" ) . css ( 'height' , ( numDataRows * 25 + 25 ) + 'px' ) ; } dataView . setItems ( data ) ; grid . resizeCanvas ( ) ; grid . render ( ) ; } function onLoadSuccess ( ) { onLoadPartial ( ) ; $ ( '#SIDAC-message' ) . html ( '' ) ; } function onLoadError ( ) { if ( errorTrace <= 1 ) { disableTitleBar = true ; $ ( '#SIDAC-grid' ) . hide ( ) ; $ ( '#SIDAC-titlebar' ) . css ( "border" , "1px solid grey" ) ; $ ( '#SIDAC-collapseGrid' ) . attr ( 'class' , 'ui-icon ui-icon-alert' ) ; $ ( '#SIDAC-collapseGrid' ) . attr ( "title" , "Failed to load data." ) ; $ ( '.grid-footnote' ) . html ( '' ) ; } if ( errorTrace < 0 ) { alert ( "Could open Allele Coverage table data file\n'" + dataFile + "'." ) ; } else { alert ( "An error occurred loading Allele Coverage data from file\n'" + dataFile + "' at line " + errorTrace ) ; } $ ( '#SIDAC-message' ) . append ( '<span style="color:red;font-style:normal">ERROR</span>' ) ; } $ ( '#SIDAC-message' ) . html ( 'Loading...' ) ; if ( dataFile == null || dataFile == undefined || dataFile == "" ) { return onLoadError ( ) ; } $ . get ( dataFile , function ( mem ) { var lines = mem . split ( "\n" ) ; $ . each ( lines , function ( n , row ) { errorTrace = n ; var fields = $ . trim ( row ) . split ( '\t' ) ; var chr = fields [ 0 ] ; if ( chr == '' ) return true ; if ( n > 0 ) { data [ numRecords ] = { id : Number ( numRecords ) , chrom : chr , position : Number ( fields [ 1 ] ) , targetid : fields [ 2 ] , hotspotid : fields [ 3 ] , call : fields [ 4 ] , reference : fields [ 5 ] , allelefreq : Number ( fields [ 6 ] ) , coverage : Number ( fields [ 7 ] ) , cov_a : Number ( fields [ 8 ] ) , cov_c : Number ( fields [ 9 ] ) , cov_g : Number ( fields [ 10 ] ) , cov_t : Number ( fields [ 11 ] ) , cov_d : Number ( fields [ 12 ] ) , cov_i : Number ( fields [ 13 ] ) , cov_f : Number ( fields [ 14 ] ) , cov_r : Number ( fields [ 15 ] ) } ; if ( selectAppendUnique ( '#SIDAC-selectChrom' , chr , chr ) ) { chrMap [ chr ] = chrNum ++ ; } ++ numRecords ; if ( loadUpdate > 0 && numRecords % loadUpdate == 0 ) onLoadPartial ( ) ; } } ) ; } ) . success ( onLoadSuccess ) . error ( onLoadError ) ; }
dataView, grid, columns, data and chrMap[] all defined above
dataView grid columns data and chrMap [] all defined above
// continue // record unique identifies and order of chromosomes from source