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
Thanks
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
Hello Svetoslav ,
Thanks for reply.
Issue is solved, I have added:
1 )Insert Under the ('iggridupdatingrowadded', function (evt, ui) { }
2).Update Under the ('iggridupdatingeditrowended', function (evt, ui){]
3 Delete under ('iggridupdatingrowdeleting', function (evt, ui) {}
another issue currently ,i am facing,
1).if i have click on cell for edit and click on cancel button without editing any field, still ('iggridupdatingeditrowended', function (evt, ui){} event get fired , it should get fire only when i would click on Done button.
Glad you got that resolved.
The other issue you are experiencing is by design and the 'editRowEnded' event fires in any case when you stop editing, even without changing anything.
If you need to have logic that should be executed only when you have edited a cell and clicked the Done button, the event provides custom property 'ui.updated'. It is 'true' when these conditions are met, otherwise it's 'false'.
One way to prevent the changes from applying when clicking on another row/cell is to change the values in the 'editRowEnding' event:
The second part of the 'if' checks if the grid table has the element that triggered the event, usually it is a cell or a row. We check the length since it returns an array.If the cell or the row is part of the grid table this will replace the new values with the old values.
The Done/Cancel buttons are not part of the grid table and are outside elements. This way you will still be able to save changes when clicking on the Done button.
Let me know if this works out for you.
hi Svetoslav,
sorry for late reply
I am able to impletement UI.update, but the problem is now. if i make any changes in one of the cell value in specific row (without clicking done/cancel) if i click on another row still value of my last clicked row got saved.
how can solve this
for e.g. as per attached screen shot
now i am editing row no.7, i have already made changes in Note field that why Done button is enable, without clicking Done button if i will click on row no.6, a note field value in row no.7 still get updated in DB. how can restrict that?
Hi,Svetoslav
Sorry for late reply,
i tried to implement what you suggest, but there is not luck. can you please provide one sample for the same.
Thanks.
yogesh