Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

position in front-end according to sortorder


Reply


2 Posts   512 Views

Avatar
Stefdv

Community Member, 110 Posts

26 February 2011 at 5:09am

Hi UC,

I'm using your SortableDataObject::add_sortable_many_many_relation(). Everything is working great. My question concerns the use in a template.

On my page i need to order the DataObjects according the Value of the SortOrder. I managed to do just that, but i like to think there's a nicer way to do so.

right now i'm using a lot of if - loops to place my DO's in a table. Now this table has a lot of combined fields so i have to build the table step-by-step ( rowspans , it's a table for a pedigree);

----------------------------------------------------------
    <table >
<% control Stamboom %>
<tr>
<td rowspan="4">
         <% control StamboomPugs %>
   <% if SortOrder = "0" %>
   <% if Titel %>
         <span class="champtitel">$Titel</span>
   <% else %>
   <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
   <% end_if %>
<% end_if %>
<% end_control %>
</td>
   
<td rowspan="4">
<% control StamboomPugs %>
   <% if SortOrder = "0" %>
   $KennelNaam <br />
                  ($Color)
<% end_if %>
<% end_control %>
   </td>
<td rowspan="2">          
         <% control StamboomPugs %>
   <% if SortOrder = "2" %>
   <% if Titel %>
         <span class="champtitel">$Titel</span>
   <% else %>
   <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
   <% end_if %>
<% end_if %>
<% end_control %>
</td>
   <td rowspan="2">
<% control StamboomPugs %>
   <% if SortOrder = "2" %>
   $KennelNaam <br /> ($Color)
<% end_if %>
<% end_control %>
   </td>

<td >    
         <% control StamboomPugs %>
   <% if SortOrder = "6" %>
   <% if Titel %>
         <span class="champtitel">$Titel</span>
   <% else %>
   <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
   <% end_if %>
<% end_if %>
<% end_control %>
</td>
<td>
<% control StamboomPugs %>
   <% if SortOrder = "6" %>
   $KennelNaam <br /> ($Color)
<% end_if %>
<% end_control %>
--------------------------------------------------------------
etc. you get the idea

Is there a way to do such a thing in a nicer way?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 February 2011 at 6:35am

The control block doesn't replicate the sort order that is specified in the backend? It should.