Ticket T616846
Visible to All Users

DataGrid - Access both column and component instances in setCellValue in Angular

created 7 years ago

Hi team,

I tried firing setcellvalue callback on cell value change.at the same time I need to change the value of another column for this I need to have row data.To access row data  I tried setting global variable value in roweditstart event with batch edit mode.The strange thing I am facing is row data won't be available in setvalue callback.I am using DX datagrid html5,type script and angular. Please suggest what could be the problem and what could be the solution. Your help much appreciated.

Kind regards

Answers approved by DevExpress Support

created 7 years ago (modified 3 years ago)

Hi,

Updated

As I understand, you wish to access a component instance and also keep the callback function execution context? If so, you can use the apply method to complete this task:

TypeScript
constructor(service: Service) { ... origOnSetCellValue = this.setCellValue; this.setCellValue = function() { origOnSetCellValue.apply(this, [].slice.call(arguments, 0, 3).concat([that])); }; } setCellValue(rowData, value, currentData, componentInstance){ console.log(componentInstance); rowData[(<any>this).dataField] = value; rowData.FirstName = "foo"; }

Please check this example demonstrating this scenario.
If your idea is different, use the "Fork" button to illustrate the issue in action and post the updated link here for further research. We'll do our best to put you on the right track.

We look forward to your reply.

    Show previous comments (3)
    CV CV
    Charles Vincent 7 years ago

      If lets say I am using call back widget to access components properties …how do I find the current data field which the setcellvalue called for…??

      Artem (DevExpress Support) 7 years ago

        Do you mean that you wish to access a component instance and also keep the callback function execution context? If so, check this example demonstrating this scenario.
        If your idea is different, use the "Fork" button to illustrate the issue in action and post the updated link here for further research. We'll do our best to put you on the right track.

        CV CV
        Charles Vincent 7 years ago

          You did the trick… appreciate your actions…

          Kind regards

          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.