Skip to content

AdvanceGridComponent

reference
3 min readUpdated

Kind: Class

Source: Frontend/src/app/components/shared/advance-grid/advance-grid.component.ts (line 21)

Part of: Frontend

AdvanceGridComponent is an Angular shared component that manages grid pagination, page visibility, and grid update handling. It initializes paging state, responds to Angular change detection, and exposes methods for moving between pages or checking grid-related callbacks.

Implements: OnInit, DoCheck

Methods

MethodSignatureReturns
ngDoCheckngDoCheck()void
ngOnInitngOnInit()void
setPagessetPages(goToLastPage: boolean)void
checkFullPagecheckFullPage(index: undefined)boolean
goToPagegoToPage(index: number)void
prevPageprevPage()void
nextPagenextPage()void
visibleAddNewvisibleAddNew()void
checkCallbackcheckCallback(button: PopOverButtonData)void
cellUpdated_HandlercellUpdated_Handler(e: undefined)void
CallisProcessActiveCallisProcessActive(accessList: undefined, acessStatusId: undefined)void
onDocumentKeyUponDocumentKeyUp(event: undefined)void
onDocumentClickonDocumentClick(event: undefined)void
closeAllRequest_HandlercloseAllRequest_Handler(e: undefined)void
selectAllRowsselectAllRows(e: undefined)void
rowSelectedRequest_HandlerrowSelectedRequest_Handler(row: undefined)void
rowOutputPopOverClicked_HandlerrowOutputPopOverClicked_Handler(e: undefined)void
customizeSelect_allbuttoncustomizeSelect_allbutton()void
PopoverSingleRowClickPopoverSingleRowClick(e: undefined)void
Popover_ClickPopover_Click(status: undefined, bool: undefined)void
IsUnitizedIsUnitized()void
unitizedRequested_ClickunitizedRequested_Click()void
packageRequested_ClickpackageRequested_Click()void
splitRequested_ClicksplitRequested_Click()void
splitSingleClicksplitSingleClick(e: undefined)void
unitizedSingleClickunitizedSingleClick(e: undefined)void
packageSingleClickpackageSingleClick(e: undefined)void
findColumnfindColumn(columFieldName: string)AdvColumn
selectedHasPackageselectedHasPackage()boolean
selectedHasItemizedselectedHasItemized()boolean
showPackageUnitizeDependOnSelectedRowsshowPackageUnitizeDependOnSelectedRows(checkType: string)void
deleteRowRequest_HandlerdeleteRowRequest_Handler(rowIndex: number)void
deleteMultiRowsdeleteMultiRows()void
deleteItemConfirmationdeleteItemConfirmation(rowIndex: number)void
deleteItemsConfirmationdeleteItemsConfirmation()void
closeDeleteModalcloseDeleteModal()void
getDeleteModalMessagegetDeleteModalMessage()string
confirmDeleteconfirmDelete()void
saveRowManually_HandlersaveRowManually_Handler(row: undefined)void
addNewRowaddNewRow(e: CellItemEvent)void
nextCellRequest_HandlernextCellRequest_Handler(e: CellItemEvent)void
isColumnDisabledOnValueisColumnDisabledOnValue(rowIndex: number, index: number)void
getNextRowNumbergetNextRowNumber(rowIndex: number, index: number)void
rowHovered_HandlerrowHovered_Handler(rowIndex: number)void
setFocusedRowsetFocusedRow(rowIndex: number)void
openEditopenEdit(rowIndex: number)void
closeEditcloseEdit()void
colSpanCountcolSpanCount()void
ngOnDestroyngOnDestroy()void
OnOpenedPopupOnOpenedPopup()void

Properties

PropertyType
advancedGridTbodyElementRef
rowComponentsQueryList<AdvRowComponent>
sharedPopupSharedPopupComponent
splitRowComponentSplitRowComponent
focusedRowAdvRowComponent
focusedRowIndexnumber
_columnsBehaviorSubject<AdvColumn[]>
_dataSourceBehaviorSubject<any[]>
readOnlyboolean
maxRowsnumber
highlightedRowIndexnumber
colWidthstring
rowHeightstring
serialEnabledboolean
selectEnabledboolean
selectAllEnabledboolean
deleteColumnEnabledboolean
actionsDropdownEnabledboolean
deleteManuallyHandledboolean
allowDeleteRowboolean
saveColumnEnabledboolean
headerVisibleboolean
handlerEnabledboolean
statusEnabledboolean
addButtonaddButton
serialFieldstring
splittedEnabledboolean
splittedSerialFieldstring
selectFieldstring
keyFieldstring
cssClassstring
isProcessActiveboolean
disabledTriggerFieldstring
hidePackageUnitizeSwitchboolean
ImportOptionany
_PopOverButtonsBehaviorSubject<PopOverButtonData[]>
newRowRequestedEventEmitter<any>
unitizedRequestedEventEmitter<any>
packageRequestedEventEmitter<any>
splitRequestedEventEmitter<any>
RowCheckedEventEmitter<any>
OutputPopOverArrayEventEmitter<any[]>
OutputPopOverClickedEventEmitter<any[]>
parameterOfisProcessActiveEventEmitter<any>
cellUpdatedEventEmitter<any>
selectedLiveDatasourceValueEventEmitter<any>
deleteRowRequestany
deleteMultiRowsRequestany
deleteRowConfirmedany
saveRowRequestany

Where it refuses work

  • AdvanceGridComponent stops the work with an early return when this.isColumnDisabledOnValue(rowIndex, index), in 2 places.
  • AdvanceGridComponent stops the work with an early return when !this.tempCellItemEvent.
  • AdvanceGridComponent stops the work with an early return when event.row >= value.length.
  • AdvanceGridComponent stops the work with an early return when this.datasourcePages[index].length > this.pageSize.
  • AdvanceGridComponent stops the work with an early return when !this.addButton.
  • AdvanceGridComponent stops the work with an early return when this.addButton.displayLogic.

Diagram

mermaid
graph LR
  A[AdvanceGridComponent] --> B[ngOnInit]
  A --> C[ngDoCheck]
  B --> D[setPages]
  C --> E[checkFullPage]
  A --> F[goToPage]
  A --> G[prevPage]
  A --> H[nextPage]
  A --> I[visibleAddNew]
  A --> J[checkCallback]
  A --> K[cellUpdated_Handler]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { AdvanceGridComponent } from './components/shared/advance-grid/advance-grid.component';

@Component({
  selector: 'app-grid-page',
  template: `
    <app-advance-grid #grid></app-advance-grid>

    <button type="button" (click)="previousPage()">Previous</button>
    <button type="button" (click)="nextPage()">Next</button>
  `,
})
export class GridPageComponent {
  @ViewChild('grid') grid?: AdvanceGridComponent;

  previousPage(): void {
    this.grid?.prevPage();
  }

  nextPage(): void {
    this.grid?.nextPage();
  }

  refreshPagination(): void {
    this.grid?.setPages();

    if (this.grid?.checkFullPage()) {
      this.grid.goToPage();
    }
  }
}

AI Coding Instructions

  • Keep paging state changes inside setPages, goToPage, prevPage, and nextPage rather than duplicating page calculations in parent components.
  • Do not call ngOnInit or ngDoCheck directly; Angular invokes lifecycle hooks.
  • Call setPages after changing the grid data source or conditions that affect page availability.
  • Use checkFullPage before page-navigation behavior that depends on whether the current page is full.
  • Preserve callback and cell-update handling through checkCallback and cellUpdated_Handler when extending grid event behavior.

Used by

6 references from 6 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (6)

  • ProcurementOfferComponentFrontend/src/app/components/procurement/procurement-details/procurement-offer/procurement-offer.component.ts:1
  • ProcurementOrderComponentFrontend/src/app/components/procurement/procurement-details/procurement-order/procurement-order.component.ts:1
  • PurchasingOfferComponentFrontend/src/app/components/purchasing/purchasing-details/purchasing-offer/purchasing-offer.component.ts:1
  • OrderPanelDetailsComponentFrontend/src/app/components/sales/new-job/order-panel-details/order-panel-details.component.ts:1
  • TranslateHandlerFrontend/src/app/components/shared/shared.module.ts:1
  • ReceivedPurchaseOrderComponentFrontend/src/app/components/warehouse/receiving-shipment-details/received-purchase-order/received-purchase-order.component.ts:1

Was this page helpful?

Download as PDF