21293 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 574 Views |
-
TableListField - results not displaying

1 June 2011 at 10:27pm Last edited: 1 June 2011 10:28pm
Hi,
I've been playing with the TableListField for the last week and followed the recipe here:
http://doc.silverstripe.org/sapphire/en/reference/tablelistfield
The form works great apart from in the admin where I display the results. The table of data is there with pagination and export, print, delete etc only the table of data has blank rows. The data is captured ok in the database and exports fine, just won't display in the admin.
Here is my code:
function getReportField(){
$myTableListField = new TableListField(
'EmailFormDatas',
'EmailFormData',
array('DateCreated', 'FirstName', 'LastName', 'Phone', 'Email')
);// custom DataObjectSet
$myEmailFormData = DataObject::get('EmailFormData');
$myTableListField->setCustomSourceItems($myEmailFormData);
// csv export
$myTableListField->setPermissions(array('export', 'print', 'delete'));
$myTableListField->setFieldListCsv(array(
'FirstName' => 'First name',
'LastName' => 'Last name',
'Phone' => 'Phone',
'Email' => 'Email'
));
$myTableListField->setFieldCasting(array(
'FirstName' => 'Text',
'LastName' => 'Text',
'Phone' => 'Text',
'Email' => 'Text'
));
$myTableListField->setShowPagination(true);
if(isset($_REQUEST['printable'])) {
$myTableListField->setPageSize(false);
} else {
$myTableListField->setPageSize(20);
}return $myTableListField;
}
}Anyone else had this problem?
Regards
-
Re: TableListField - results not displaying

3 June 2011 at 11:23am
Still having trouble with this, but now I've uploaded to a live server to test it turns out that once I've submited the form once my 'admin' no longer works and I'm getting a server error message.
| 574 Views | ||
|
Page:
1
|
Go to Top |

