Announcement

Collapse
No announcement yet.

How to render list of entities?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to render list of entities?

    I want to render list with 'pagination' (load more) for entities in my custom view.

    js: createView('foobar', 'views/record/list', { fullSelector: '#asd' })
    Uncaught (in promise) Error: Collection has not been injected into views/record/list view.​
    js: createView('foobar', 'views/record/list', { fullSelector: '#asd', collection:{total:20, list: [],} })
    .on is not defined (or something error says)

  • #2
    Create a collection and pass to the list view. I recommend to search for examples in the code base.

    If you need for a specific entity type, then use a collection factory.

    Code:
    setup() {
        this.wait(
            this.getCollectionFactory().create('MyEntityType').then(collection => {
                this.createView(...);
            })
        );
    }

    Comment


    • sequencer
      sequencer commented
      Editing a comment
      Tanks a lot! Saved my day. Yes, I've tried my best for 2 hours before posting question on forum (as I usually do)
      But you know, searching how thing works in unfamiliar codebase might be troublesome.
Working...
X