mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Fixed pagination in TableListField after hsmith's changes
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63819 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
332da65edb
commit
51447b89ab
@ -262,10 +262,10 @@ class TableListField extends FormField {
|
||||
function index() {
|
||||
return $this->FieldHolder();
|
||||
}
|
||||
|
||||
|
||||
static $url_handlers = array(
|
||||
'item/$ID' => 'handleItem',
|
||||
'$Action!' => '$Action',
|
||||
'$Action' => '$Action',
|
||||
);
|
||||
|
||||
function sourceClass() {
|
||||
|
@ -94,6 +94,24 @@ class TableListFieldTest extends SapphireTest {
|
||||
$this->assertEquals(array(3 => "a3", 4 => "a4"), $itemMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that visiting the field's URL returns the content of the field.
|
||||
* This capability is used by ajax
|
||||
*/
|
||||
function testAjaxRefreshing() {
|
||||
$controller = new TableListFieldTest_TestController();
|
||||
$table = $controller->TestForm()->Fields()->First();
|
||||
|
||||
$ajaxResponse = Director::test($table->Link())->getBody();
|
||||
|
||||
// Check that the column headings have been rendered
|
||||
$this->assertRegExp('/<th[^>]*>\s*Col A\s*<\/th>/', $ajaxResponse);
|
||||
$this->assertRegExp('/<th[^>]*>\s*Col B\s*<\/th>/', $ajaxResponse);
|
||||
$this->assertRegExp('/<th[^>]*>\s*Col C\s*<\/th>/', $ajaxResponse);
|
||||
$this->assertRegExp('/<th[^>]*>\s*Col D\s*<\/th>/', $ajaxResponse);
|
||||
$this->assertRegExp('/<th[^>]*>\s*Col E\s*<\/th>/', $ajaxResponse);
|
||||
}
|
||||
|
||||
function testCsvExport() {
|
||||
$table = new TableListField("Tester", "TableListFieldTest_CsvExport", array(
|
||||
"A" => "Col A",
|
||||
@ -162,4 +180,18 @@ class TableListFieldTest_TestController extends Controller {
|
||||
function Link() {
|
||||
return "TableListFieldTest_TestController/";
|
||||
}
|
||||
function TestForm() {
|
||||
$table = new TableListField("Table", "TableListFieldTest_Obj", array(
|
||||
"A" => "Col A",
|
||||
"B" => "Col B",
|
||||
"C" => "Col C",
|
||||
"D" => "Col D",
|
||||
"E" => "Col E",
|
||||
));
|
||||
|
||||
// A TableListField must be inside a form for its links to be generated
|
||||
return new Form($this, "TestForm", new FieldSet(
|
||||
$table
|
||||
), new FieldSet());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user