Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
360
Getting error while call function under rowAdded: function (evt, ui)
posted

Hi,

 I am using Iggrid in My Angular 2 project, there is 2 Typescript File (.ts)

1.PostService.ts : as we are using webapi in our project ,this file contain the post,get,put method

2.NewPurchase.ts :this file contain the iggrid.

When i am calling function defined in Postservice.ts, into Newpurchase.ts under the  rowAdded: function (evt, ui) or 

editRowEnded: function () its giving me following error:

TypeError: Cannot read property 'putSightPurchases' of undefined at HTMLTableElement.rowAdded.

Please find attached ScreenShot Here.
NewPurchase
postservice

Thanks

  • 275
    Offline posted

    Hello Yogesh,

    From what I can see 'PostService'  element is not present in the 'this'  scope of the 'rowAdded'  event handler.
    That is why the 'putSightPurchases'  is not available as well. This is due to the 'this'  scope changing within a function depending on how it is called.

    I would suggest based on the information you have provided is to either store the 'this'  scope you need into a variable or using a different method of selecting the 'PostService'.

    It would greatly help if you need more assistance to provide us with a sample that we could see more clearly how things are handled.

    Regards,
    Svetoslav Krastev,
    Infragistics