Module Builder: sorting list items?
I have created a Staff Biographies module using the new module builder (love it!). I need to set the display order of the list items so I can display staff in the appropriate order (President, Executive Director, Clinical Directros, etc.). I included a numeric field named SortOrder in my module hoping that I could use that for sorting.
After dropping the widget on a page and selecting the "List Settings" edit options, I can see a combobox labeled "Sort Staff Biographies" which has options for the following:
Last published on top
Last modified on top
By Title (A-Z)
By Title (Z-A)
As set in Advanced mode
When I click in the "Advanced" button in the widget edit window I see nothing that appears to be related to item sort order. Am I missing something?
--Steve
Can any please, respond to this post, I am trying to order the items created in the modulebuilder .
I've created 7 items .. Youth - Partners - Services - Research - Employee- Invlove - Contact
I want to order them to be like .. Partners - Youth - Research ... etc..
I want to change their order, but it doesn't depend on any thing like A-Z .. or Z-A .. no i want to choose the order with my self .. 4 example .I wanna be able to order those items the same way i order the pages ..
Hello,
The "As Set in Advanced Mode" setting for the filtering is for the Filter Expression that you have exposed in the Advanced settings in the designer. You can access that from Advanced >> ControlDefinition >> Views >> FrontendList >> DynamicContentMasterView. The only other way to filter the items would be to create a custom control and then make queries using the generated code reference for the module and filter the collection by the fields you would like. Same counts for ordering - you can either set it with the SortExpression, found again in Advanced >> ControlDefinition >> Views >> FrontendList >> DynamicContentMasterView or create a control that orders the collection of the items.
Kind regards,Hi Svetoslav,
I ended up creating a custom control and doing some simple sorting like so:
var myCollection = dynamicModuleManager.GetDataItems(staffBioType).Where(i => i.Status == ContentLifecycleStatus.Live).OrderBy(i => i.GetValue<
decimal
>(
"SortOrder"
));
public
class
StaffBioSorter : IComparer<DynamicContent>
public
int
Compare(DynamicContent x, DynamicContent y)
Hi Steve,
In the Compare method, you can use:
var xSortOrder = x.GetValue<
decimal
>(
"SortOrder"
);
var ySortOrder = y.GetValue<
decimal
>(
"SortOrder"
);
using
Telerik.Sitefinity.Model;
using
Telerik.Sitefinity.DynamicModules;
using
Telerik.Sitefinity.Data.Linq.Dynamic;
using
Telerik.Sitefinity.DynamicModules.Model;
using
Telerik.Sitefinity.Utilities.TypeConverters;
Hi Dimitar,
That's the first thing I tried but the DynamicContent class does not implement a GetValue method (see attached image)
Steve
Hello Steve,
Have you added the namespaces, I've mentioned?
Greetings,
Dimitar Dimitrov
Sitefinity team
Oops. No, I missed the "Telerik.Sitefinity.Model" namespace--working fine now.
Thanks,
Steve
When using the "As Set in Advanced Mode" for sorting items, is there a way to specify a classification that's set to "Only one classification item can be selected" as the field to be sorted by, or would that require a custom control?
Svetoslav,
We are currently using 5.4. I looked for the settings path that you specified but am unable to find it in 5.4. I did find Advanced >> ContentView >> Controls >> [[YourDynamicModule]] >> Views and also Advanced >> DynamicModules >> Controls >> [[YourDynamicModule]] >> Views. The former path does have a Sort Expression setting that works on the backend but I'm unable to find any settings that will control the frontend sort order.
Is there an area that does allow you to set the sort order for the frontend without resorting to writing a custom ASCX?
I found the solution. The display order for the frontend can be set directly in the UI. It doesn't require that you even go to the Administration >> Settings area.
Where?
In the widget properties, I go to "Advanced--Home--ControlDefinition--Views--DynamicContentMasterView" and set the sort expression to the name of my custom field and hit "Save" but when I go back in, it still says "PublicationDate Desc" I've tried several field names, but It always reverts back to the default.