/posts and /comments Master-Detail

We will get posts and comments from JSONPlaceholder and show them in Master-Detail relationship format. So, chapters Master - Detail Grid and /todos resource are prerequisites for this chapter.

As we did in previous chapter, create ListPosts, GetPost, AddPost, UpdatePost, DeletePost and ListPostComments methods.

ListPosts:

Listing method's parameters can be generated automatically, for other methods you need to add parameters manually.

GetPost:

AddPost:

UpdatePost:

DeletePost:

Generate parameters of ListPostComments method by burn button and then add postId parameter manually.

Create queries from ListPosts and ListPostComments methods and then grids from those queries. Set userId field's post process to Lookup Query and select ListUsers lookup query.

Add postId parameter to comments query for Master - Detail relationship.

Create Posts page and add grd_rest_posts first then add grd_rest_comments as detail grid.

This is important and different than how we usually configure Master - Detail relationship. Write this code on page.

grd_rest_posts.ds.reload()

That's it.