MINOR Making full result table rows in ModelAdmin selectable

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92773 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 03:17:49 +00:00
parent c9646d8d43
commit 2683a5ae62
3 changed files with 10 additions and 9 deletions

View File

@ -606,6 +606,7 @@ class ModelAdmin_CollectionController extends Controller {
$resultsForm = $this->ResultsForm(array_merge($form->getData(), $request)); $resultsForm = $this->ResultsForm(array_merge($form->getData(), $request));
// Before rendering, let's get the total number of results returned // Before rendering, let's get the total number of results returned
$tableField = $resultsForm->Fields()->dataFieldByName($this->modelClass); $tableField = $resultsForm->Fields()->dataFieldByName($this->modelClass);
$tableField->addExtraClass('resultsTable');
$numResults = $tableField->TotalCount(); $numResults = $tableField->TotalCount();
if($numResults) { if($numResults) {

View File

@ -61,8 +61,8 @@ body.ModelAdmin #SearchForm_holder form div#ResultAssembly{
width: 45%; width: 45%;
} }
body.ModelAdmin #ResultTable_holder { body.ModelAdmin .resultsTable tbody td {
overflow:auto; cursor: pointer;
} }
body.ModelAdmin #right{ body.ModelAdmin #right{

View File

@ -19,12 +19,12 @@
*/ */
$('#ModelClassSelector select').concrete({ $('#ModelClassSelector select').concrete({
onmatch: function() { onmatch: function() {
var self = this;
// Set up an onchange function to show the applicable form and hide all others // Set up an onchange function to show the applicable form and hide all others
this.bind('change', function(e) { this.bind('change', function(e) {
var $selector = $(this); self.find('option').each(function() {
this.find('option').each(function() {
var $form = $('#'+$(this).val()); var $form = $('#'+$(this).val());
if($selector.val() == $(this).val()) $form.show(); if(self.val() == $(this).val()) $form.show();
else $form.hide(); else $form.hide();
}); });
}); });
@ -96,13 +96,13 @@
/** /**
* Table record handler for search result record * Table record handler for search result record
*/ */
$('form[name=Form_ResultsForm] tbody td a').concrete({ $('.resultsTable tbody td').concrete({
onmatch: function() { onmatch: function() {
// TODO Replace with concrete event handler // TODO Replace with concrete event handler
this.bind('click', function(e) { this.bind('click', function(e) {
if($(this).hasClass('deletelink downloadlink')) return true; var firstLink = $(this).find('a[href]');
if(!firstLink) return;
$('#Form_EditForm').concrete('ss').loadForm($(this).attr('href')); $('#Form_EditForm').concrete('ss').loadForm(firstLink.attr('href'));
return false; return false;
}); });
} }