How to render list of entities?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sequencer
    Junior Member
    • Apr 2024
    • 16

    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)
  • yuri
    Member
    • Mar 2014
    • 8627

    #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(...);
            })
        );
    }
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    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...