7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Row number in DataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 786 Views |
-
Row number in DataObjectManager

23 October 2010 at 3:04am
Is there anyway to display a row number column in the DataObjectManager? Thanks!
-
Re: Row number in DataObjectManager

23 October 2010 at 3:10am
You can use $Pos for that.
In your theme or project /templates/ directory, create DataObjectManager.ss
Copy the contents over from /dataobject_manager/templates/DataObjectManager.ss
Make the following change:
<% control Items %>
<li class="data" id="record-$Parent.id-$ID"> <!-- added this -->$Pos <!-- /end -->
<div class="fields-wrap">
<% control Fields %>
<div class="col" {$ColumnWidthCSS}><div class="pad"><% if Value %>$Value<% else %> <% end_if %></div></div>
<% end_control %>
</div>
<div class="actions col">
<% include Actions %>
</div>
</li>
<% end_control %>--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: Row number in DataObjectManager

23 October 2010 at 3:25am
Thanks for the quick reply, UncleCheese. I put the template in /mysite/templates/DataObjectManager.ss and it works. However, all the DOM in my CMS is showing the $Pos now. I am still quite new to SS, is it possible to use different template for different instances of DOM?
-
Re: Row number in DataObjectManager

23 October 2010 at 3:37am
Hmm.. no, not much you can do there, unless you subclass DataObjectManager.
MyDataObjectManager.php
class MyDataObjectManager extends DataObjectManager {
protected $template = "MyDataObjectManager";
}Then you can rename the template "MyDataObjectManager.ss"
That will probably work!
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: Row number in DataObjectManager

23 October 2010 at 4:01am
Subclassing sounds like a reasonable solution. I guess the other way is to add a css class to show/hide the $Pos value as necessary. Thanks for pointing out the $Pos possibility.
-
Re: Row number in DataObjectManager

23 October 2010 at 4:42am
Anything is {$Pos}sible in Silverstripe.
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com
| 786 Views | ||
|
Page:
1
|
Go to Top |

