Ticket T716134
Visible to All Users

DataGrid - How to call component methods from the setCellValue callback

created 6 years ago

Hello,

I wan't to call a methode within the setCellValue methode.

When I use the setCellValue functionality from the DataGrid:

HTML
<dxi-column dataField="bdeQtyBad" caption="BadParts" [width]="100" [setCellValue]="setPPM_Bad" >

which executes:

JavaScript
setPPM_Bad(newData, value, currentRowData): void { // do stuff here this.checkAllNecessaryValuesThereBeforeKpiCalculation(currentRowData, newData ); // here I get the error // (ERROR TypeError: this.checkAllNecessaryValuesThereBeforeKpiCalculation is not a function) }

the function looks like this:

JavaScript
checkAllNecessaryValuesThereBeforeKpiCalculation (currentRowData, newData): void { //do stuffe here, (check if value already exists) newData.otherColumnName = ....... }

Is here a possibility to call the second function within the setCellValue possibility?
Thanks in advance
Best
Jo

Answers approved by DevExpress Support

created 6 years ago (modified 6 years ago)

Hi,

You need to change the default setCellValue execution context. Please check the following help topic: Callback Functions

Let us know if this suggestion helps.

    Comments (1)

      That's it!

      Forgot to bind the setPPM_Badwhithin the constructor…

      this.setPPM_Bad = this.setPPM_Bad.bind(this);solved the Problem!

      Best and thx
      Jo

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.