簡體   English   中英

在錯誤的Ag-Grid單元上顯示的角度工具提示

[英]Angular Tooltip showing on the wrong Ag-Grid cell

我正在使用Ag-grid生成表,我進行了單元格驗證以檢查單元格的值。 對於錯誤的值,我想顯示一個工具提示 我已經做到了所有這些,除了工具提示不是在輸入錯誤的單元格上顯示,而是在右邊的第一個單元格上顯示,僅在那兒顯示。

在此處輸入圖片說明

我的密碼

data.map(object => {
        Object
          .keys(object)
          .map(key => {
            let mappedColumn = {
              headerName: key,
              field: key,
              hide: this.configurationSettings.hide,
              cellRenderer: "cellEditorComponent",    
              pinned: null,             
              inputType: this.inputType,
              cellStyle: (event) => { return this.cellValidation(event) },
              tooltip: (event) => { return this.setErrorMessage(event) }
            }
        columnDefinitions.push(mappedColumn);

cellValidation(param: any) {
    this.isValid=true;
    if (param && param.node && !param.node.lastChild && this.validateInput && !this.validateInput.test(param.value))
    {
      this.isValid = false;
      return { 'background-color': 'rgb(255, 230, 230)', 'border-color': 'red', 'font-weight': 'normal'    }
        }else if (param && param.node && param.node.lastChild && param.node.data["Consultant"] == "Planned hours")
        {
          return {'font-weight': 'bold'};
        }
}

     setErrorMessage(param: any) {
        //if (param && this.cellValidation(param) != null)
        if (!this.isValid) { 
          return this.errorMessage; 
        }
      }

好吧,我不知道為什么,但這解決了這個問題:

 setErrorMessage(param: any) {
    if (param && this.cellValidation(param) != null && !this.isValid)
    { return this.errorMessage;}}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM