List order by field?

Topics: Customizing Orchard
Jun 9, 2011 at 7:30 AM

I have a list of items that I want to be sorted by a specific text-field, how would i go about doing this? I noticed there was a few precreated ones (for the Custom-fields), but I would prefer not to use those and instead go with just a Textfield. I'm looking at EditorTemplates/Container.cshtml and wish to add a field for my specific sort, how would I go about changing this?


        @Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPart.TextField", T("My custom sort").Text)

as an example. :)

Coordinator
Jun 9, 2011 at 7:35 AM

You can't order by field. Yet. What you can do is add custom properties through a part that was built as a workaround for this. It has three properties that you can use for sorting.

Jun 9, 2011 at 8:25 AM

Content field values are saved as XML in the database. You should create content parts for filtering.

@bertrandleroy: By Yet. you mean that the team is considering changing the way content-fields are handled in Orchard?

Coordinator
Jun 9, 2011 at 8:44 AM

Possibly, yes.

Jun 9, 2011 at 9:34 AM

Is RavenDB part of this possibly? Since you already save it as XML it seems pretty clear that a move toward ravendb should allow LINQ queries agains JSON documents. But it looks as though people will need to buy ravendb for commercial usage, so along with buying a SQL Server license they would buy a RavenDB one as well ?

Jun 9, 2011 at 10:16 AM

Not forgetting of course that MSSQL has XML querying capability.

The RavenDB license isn't exactly like that. Since Orchard is open source, it can use the free / open source RavenDB license, even if you are using Orchard for a commercial site. Where you'd need to pay for the RavenDB license is if you released your own commercial product based on Orchard. That's not the same as simply deploying an Orchard site.

Jun 9, 2011 at 10:42 AM

Sweet! So if we we're to develop modules in Orchard, and use RavenDB. As long as we call that module Open Source it's fine.

But, if we develop something on top of Orchard. And that something is part of a commercial product, or we just don't release the source code for something custom. Is that technically considered a product based on Orchard ? From my point it's still Orchard, but with an extension.

Jun 9, 2011 at 11:09 AM

Alright, great. :) I think the sort by fields would be very helpful in more general cases. Granted the Custom properties will solve this, but it seems like something of an overstep at times.

Jun 9, 2011 at 11:59 AM
Edited Jun 9, 2011 at 11:59 AM
sharpoverride wrote:

Sweet! So if we we're to develop modules in Orchard, and use RavenDB. As long as we call that module Open Source it's fine.

But, if we develop something on top of Orchard. And that something is part of a commercial product, or we just don't release the source code for something custom. Is that technically considered a product based on Orchard ? From my point it's still Orchard, but with an extension.

Still not exactly right - your module can be closed source, it doesn't include RavenDB - it's just using Orchard, which is itself open source, and happens to use RavenDB. RavenDB can be distributed with any Open Source project.

The situation where it would change is if you created your own fork of Orchard that was closed source. Modules are fine since you wouldn't typically include RavenDB in their distribution.

Coordinator
Jun 9, 2011 at 11:21 PM

Not necessarily RavenDB, no, there are several ways we could get that to work. On alleged licensing issues for RavenDB, you are speculating here.

Jun 10, 2011 at 5:48 AM

I'm just thinking out loud. No speculations, just trying to see what limits should I expect. If I am to pitch Orchard to my employer, then I have to take care in not feeding him false information.