Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class AssaysTableComponent implements OnInit{
- //private rowData;
- private gridApi;
- private gridColumnApi;
- private columnDefs;
- private rowModelType;
- private paginationPageSize;
- private components;
- private rowData: any[];
- private cacheBlockSize;
- private infiniteInitialRowCount;
- allTableData : any[];
- constructor(private http:HttpClient, private appServices:AppServices) {
- this.columnDefs = [
- {
- headerName: "Date/Time",
- field: "createdDate",
- headerCheckboxSelection: true,
- headerCheckboxSelectionFilteredOnly: true,
- checkboxSelection: true,
- width: 250,
- cellRenderer: "loadingRenderer"
- },
- {headerName: 'Assay Name', field: 'assayName', width: 200},
- {headerName: 'Samples', field: 'sampleCount', width: 100}
- ];
- this.components = {
- loadingRenderer: function(params) {
- if (params.value !== undefined) {
- return params.value;
- } else {
- return '<img src="../images/loading.gif">';
- }
- }
- };
- this.rowModelType = "infinite";
- //this.paginationPageSize = 10;
- this.cacheBlockSize = 10;
- this.infiniteInitialRowCount = 1;
- //this.rowData = this.appServices.assayData;
- }
- ngOnInit(){
- }
- onGridReady(params) {
- this.gridApi = params.api;
- this.gridColumnApi = params.columnApi;
- //const allTableData:string[] = [];
- //const apiCount = 0;
- //apiCount++;
- console.log("assayApiCall>>",this.appServices.assayApiCall);
- const assaysObj = new Assays();
- assaysObj.sortBy = 'CREATED_DATE';
- assaysObj.sortOder = 'desc';
- assaysObj.count = "50";
- if(this.appServices.assayApiCall>0){
- console.log("this.allTableData >> ",this.allTableData);
- assaysObj.startEvalulationKey = {
- }
- }
- this.appServices.downloadAssayFiles(assaysObj).subscribe(
- (response) => {
- if (response.length > 0) {
- var dataSource = {
- rowCount: null,
- getRows: function (params) {
- console.log("asking for " + params.startRow + " to " + params.endRow);
- setTimeout(function () {
- console.log("response>>",response);
- if(this.allTableData == undefined){
- this.allTableData = response;
- }
- else{
- this.allTableData = this.allTableData.concat(response);
- }
- var rowsThisPage = response.slice(params.startRow, params.endRow);
- var lastRow = -1;
- if (response.length <= params.endRow) {
- lastRow = response.length;
- }
- params.successCallback(rowsThisPage, lastRow);
- }, 500);
- }
- }
- params.api.setDatasource(dataSource);
- this.appServices.setIsAssaysAvailable(true);
- this.appServices.assayApiCall +=1;
- }
- else{
- this.appServices.setIsAssaysAvailable(false)
- }
- }
- )
- }
- }
Add Comment
Please, Sign In to add comment