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
85
Consuming REST service with IgGrid + angular2
posted

I already tried a lot of things to get REST working with the IgGrid, but I have no luck and there is no good documentation on how to do this in angular2.

Which are the evens to trigger the inline create/remove/update?

I have the following grid options:

this.gridOptions = {
width: "100%",
height: "400px",
autoGenerateColumns: false,
dataSource: [],
columns: [
{ key: "code", headerText: "Code", width: "250px", dataType: "string" },
{ key: "description", headerText: "Omschrijving", width: "250px", dataType: "string" }
],
primaryKey: "id",
restSettings: {
create:{
url: '/api/client',//or this must be the full url? 
batch: false
},
update: {
url: '/api/client'
},
remove:{
url: '/api/client',
batch: false
}
},
features: [
{
name: "Updating",
columnSettings: [
{ columnKey: "id", readOnly: true }
]
},
{
name: "Paging"
},
{
name: "Filtering"
},
{
name: "Sorting"
}
]
};

After adding a new row in the grid nothing happens. The POST is not triggered and it is the same for the delete and update calls.

I've already tried to search on google for information on this topic but the only things I've found are with jQuery.

Can somebody please provide me with an answer?

Parents
No Data
Reply
  • 29417
    Offline posted

    Hello Jurgen,

    Thank you for posting in our forum.

    The grid does not automatically trigger remote requests on each change. Instead it stores the list of all transactions made on the grid and lets you decide when to send them to the server.
    To save the changes to the server the saveChanges method should be called.
    For example:
    $(".selector").igGrid("saveChanges");

    Where “.selector” should be a jQuery selector pointing to the igGrid element.

    You can find more information on the method in our API docs:

    http://www.igniteui.com/help/api/2016.1/ui.iggrid#methods:saveChanges

    Let me know if you have any additional questions or concerns.

    Best Regards,
    Maya Kirova
    Infragistics, Inc.
    http://ko.infragistics.com/support

Children