My Update query:
export const UPDATE_AUTHOR_QUERY = "mutation UpdateAuthorMutation($Author: AuthorInput!) {" +
"updateAuthor(input: $author){" +
"id," +
"firstName," +<
br
> "lastName" +<
br
> "}"+<
br
> "}";
additionalParamsOnUpdate:
function
(model){
return
{
query: UPDATE_AUTHOR_QUERY,
variables: model <br>
};
},
5 Answers, 1 is accepted
my model:
data: function() {
return {
model: {
id: "id",
fields: {
id: { type: "string", editable: false },
firstName: { type: "string" },
lastName: { type: "string" }
}
}
}
}
}
following request is send to graphql-server:
{"query":"mutation UpdateAuthorMutation($Author: AuthorInput!) {updateAuthor(input: $author){id,firstName,lastName}}","variables":{"id":"31","firstName":"A5","lastName":"Zz66"}}
The graphql server exspects:
{"query":"mutation UpdateAuthorMutation($Author: AuthorInput!) {updateAuthor(input: $author){id,firstName,lastName}}","variables":{"author": {"id":"31","firstName":"A5","lastName":"Zz66"}}}
Solved:
additionalParamsOnUpdate: function(model){
return {
query: UPDATE_AUTHOR_QUERY,
variables: {author: model }
};
},
Hi Michael,
Thank you for sharing what has solved the discussed issue in your project! The shared knowledge will surely help someone in the future.
Based on your last reply, I would assume that the current thread can be closed. I will close it but if you need further assistance, you can reopen the ticket.
Regards,
Petar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Query:
export const UPDATE_AUTHOR_QUERY = "mutation UpdateAuthorMutation($author: AuthorInput!) {" +
"updateAuthor(input: $author){" +
"id," +
"firstName," +
"lastName" +
"}"+
"}";
additionalParamsOnUpdate: function(model){
return {
query: UPDATE_AUTHOR_QUERY,
variables: {author: model }
};
},
Result:
{"query":"mutation UpdateAuthorMutation($author: AuthorInput!) {updateAuthor(input: $author){id,firstName,lastName}}"
Works fine!
Query: Create
export const ADD_AUTHOR_QUERY = "mutation AddAuthor($firstName: String!, lastName: String!) {" +
"addAuthor(firstName: $firstName, lastName: $lastName){" +
"id," +
"firstName," +
"lastName" +
"}"+
"}";
additionalParamsOnCreate: function(model) {
return {
query: ADD_AUTHOR_QUERY,
variables: {author: model }
};
},
Result after saveChanges: (not working)
{"query":"mutation UpdateAuthorMutation($author: AuthorInput!) {updateAuthor(input: $author){id,firstName,lastName}}","variables":{"author":{"id":"0","fields":"","firstName":"123","lastName":"234"}}}
Model is alway the same:
data: function() {
return {
model: {
id: "id",
fields: {
id: { editable: false, nullable: true },
firstName: { type: "string" },
lastName: { type: "string" }
}
}
}
}
Any idea out there?
Hi Michael,
Based only on the provided code, I cannot say what is the reason for the additional "fields" property that appears in the result.
Can you provide more context of what you are trying to implement? Which Kendo UI for Vue component do you use? Can you send me a runnable example in which I can reproduce the reported behavior and further investigate what is triggering it?
Regards,
Petar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.