views:

195

answers:

2

I'm using zfdatagrid to display a table within a Zend app. How do i fix the width of the table? I can't find any setting in the grid.ini.

public function displaytemptableAction()
{
    $config = new Zend_Config_Ini(APPLICATION_PATH.'/grids/grid.ini', 'production');

    $db = Zend_Registry::get("db");

    $grid = Bvb_Grid::factory('Table',$config,$id='');
    $grid->setSource(new Bvb_Grid_Source_Zend_Table(new Model_DbTable_TmpTeamRaceResult()));

    //CRUD Configuration
    $form = new Bvb_Grid_Form();
    $form->setAdd(false)->setEdit(true)->setDelete(true);
    $grid->setForm($form);

    $grid->setPagination(0);
    $grid->setExport(array('xml','pdf'));
    $this->view->grid = $grid->deploy();
}

zfdatagrid table width

A: 

It seems the table width is controlled via a css file in folder './public/styles'

td div input[type='text'] {
    width: 98% !important;
    border: 1px solid #ddd;
}

Another nice API with rubbish documentation.

emeraldjava
A: 

Just style it inside your css file like you would any other element. You can right-click view source on the page generated and see what kind of classes(if any) are given to the table/tr/td`s.

Iznogood
but where is the correct place to define the path to the css file? is this in the grid.ini - i can't see an obvious parameter to set.
emeraldjava
Just include it in your layout.phtml or index.phtml (if you are not using layouts) like you swould any other css.<link href="/public/css/default.css" media="screen" rel="stylesheet" type="text/css" />The zend way would be<?= $this->headLink()->appendStylesheet('/css/default.css')?>depending on your configuration you might have to change the path somewhat to ajust to your context.
Iznogood