21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 392 Views |
-
ComplexTableField content

14 July 2011 at 9:29am Last edited: 14 July 2011 9:45am
Hello everyone. I have a question, I know how I have to do that when I add data in a table does not add inches to the other pages too, meaning that each record is displayed only in that table. Thank you very much, I leave the code:
NuevoEquipo.php
class NuevoEquipo extends NuevaZona {
static $db = array(
'Pos' => 'Int',
'PJ' => 'Int',
'PG' => 'Int',
'PE' => 'Int',
'PP' => 'Int',
'GF' => 'Int',
'GC' => 'Int',
'DG' => 'Int',
'Puntos' => 'Int',
'Nro' => 'Int'//,
// 'Nombre' => 'text',
// 'PJ_jugad' => 'Int',
// 'PG_jugad' => 'Int',
// 'PE_jugad' => 'Int',
//'PP_jugad' => 'Int',
//'Goles' => 'Int',
//'Prom' => 'Int',
//'Tarj_a' => 'Int',
//'Tarj_r' => 'Int'
);//static $has_many = array(
//'Equipo' => 'NuevoEquipo'
//);
static $has_many = array(
'MiEquipo' => 'Equipos'
);
// function getCMSFields_forPopup() {
//$fields = new FieldSet();//$fields->push( new TextField( 'Nombre' ) );
//return $fields;
// }
function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab("Root.Content.Posicion", new FieldGroup(
new NumericField('Pos'),
new NumericField('PJ'),
new NumericField('PG'),
new NumericField('PE'),
new NumericField('PP'),
new NumericField('GF'),
new NumericField('GC'),
new NumericField('DG'),
new NumericField('Puntos')
));
$playersTablefield = new HasManyComplexTableField(
$this,
'MiEquipo',
'Equipos',
array(
'Nombre' => 'Nombre'
),
'getCMSFields_forPopup'
);
$playersTablefield->setAddTitle( 'jugador' );$fields->addFieldToTab( 'Root.Content.Estadisticas', $playersTablefield );
return $fields;
}}
class NuevoEquipo_Controller extends NuevaZona_Controller {
public static $allowed_actions = array (
);
}Equipo.php
<?php
class Equipos extends DataObject {static $db = array(
'Nombre' => 'text'
);static $has_one = array(
'Teams' => 'NuevoEquipo'
);function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'Nombre' ) );
return $fields;
}}
As you can see the images "Pepe" is added on every page (Equipo A, Equipo BB and the others), and what I want is to see only the page that I add, Hope your help!!!! Greetings
-
Re: ComplexTableField content

15 July 2011 at 3:48am
May be easier to use the DataObjectManger module instead of using a HasManyComplexTableField
-
Re: ComplexTableField content

15 July 2011 at 4:33am
solve my problem by changing the table type (hasmanycomplextablefield by complextablefield) marrow, which show in a table no longer appears in the other table but now I have another problem I can not checker my options. Monkey to seek dataobjectmanager not see results in the api, you could show me something about that object?
-
Re: ComplexTableField content

15 July 2011 at 3:04pm
I just installed the module dataobjectmanager, but I still have the same drawback anyway thanks for the suggestion ... this module has several improvements
-
Re: ComplexTableField content

16 July 2011 at 1:06am
If the same data is appearing on every page that means you're not associating it a page type. You need to associate whatever "pepe' is with your page. I assume NuevaZona is a data object as is NeuvoEquipo. Unless those have a has_one or has_many relation with a page all items will show anywhere that the DataObject is called
| 392 Views | ||
|
Page:
1
|
Go to Top |


