Skip to content

Last page from Listview throws "Failed to get entities", Listview not working without SetSortProperty #116

Open
@EVandevska

Description

Hi, I've just added the package to my project, and it looks really nice and very promising. However, unless I set:
collectionConfig.SetSortProperty(p => p.FullName, SortDirection.Descending);

it keeps throwing a Server error "Failed to get entities". It doesn't work even if I put the sort direction as Ascending instead of Descending.
Additionally, no matter what's the size of the page, I always get the error from above ('Failed to get entities'). I really don't understand why is this happening.

Here's my model:

    [TableName("CustomUsers")]
    [PrimaryKey("Id", autoIncrement = true)]
    [ExplicitColumns]
    public class CustomUser
    {
        [Column("Id")]
        [PrimaryKeyColumn(AutoIncrement = true)]
        public int Id { get; set; }

        [Column("UserId")]
        public int UserId { get; set; }

        [Column("FullName")]
        public string FullName { get; set; }

        [Column("Address")]
        public string Address { get; set; }

        [Column("City")]
        public string City { get; set; }

        [Column("Country")]
        public string Country { get; set; }

        [Column("Telephone")]
        public string Telephone { get; set; }

        [Column("Occupation")]
        public string Occupation { get; set; }
        
    }

Here's my configuration class:

    public class FluidityBootstrap : FluidityConfigModule
    {
        public override void Configure(FluidityConfig config)
        {
            config.AddSection("CustomUsers", "icon-server-alt", sectionConfig =>
            {
                sectionConfig.SetTree("CustomUsers", treeConfig =>
                {
                    treeConfig.AddCollection<CustomUser>(p => p.Id, "CustomUser", "CustomUsers", "A collection of custom users",
                        collectionConfig =>
                        {
                            collectionConfig.SetNameProperty(p => p.FullName);
                            collectionConfig.SetViewMode(FluidityViewMode.List);

                            collectionConfig.ListView(listViewConfig =>
                            {
                                listViewConfig.SetPageSize(15);

                                listViewConfig.AddField(p => p.Address);
                                listViewConfig.AddField(p => p.City);
                                listViewConfig.AddField(p => p.Country);
                                listViewConfig.AddField(p => p.Telephone);
                                listViewConfig.AddField(p => p.Occupation);
                            });

                            collectionConfig.Editor(editorConfig =>
                            {
                                editorConfig.AddTab("User Info", tabConfig =>
                                {
                                    tabConfig.AddField(p => p.FullName, fieldConfig =>
                                    {
                                        fieldConfig.SetLabel("Full Name");
                                    });
                                    tabConfig.AddField(p => p.Address);
                                    tabConfig.AddField(p => p.City);
                                    tabConfig.AddField(p => p.Country);
                                    tabConfig.AddField(p => p.Telephone);
                                    tabConfig.AddField(p => p.Occupation);
                                });
                            });

                            //must be added for Listview to work
                            collectionConfig.SetSortProperty(p => p.FullName, SortDirection.Descending);

                            collectionConfig.AddSearchableProperty(p => p.FullName);
                        });
                });

            });
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions