Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EVandevska opened this issue Aug 27, 2019 · 1 comment

Comments

@EVandevska
Copy link

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);
                        });
                });

            });
        }
    }

@EVandevska
Copy link
Author

Okay so yesterday it was a holiday so I wasn't at work, today I come in (not having changed anything) and it's working. I even tried it with ascending sort. It even works with removing the sort completely! I really don't understand why this happened lol. If I find out more info, will let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant