Hello everyboy,
My Seblod learning process is just an endless set of question....
I will try to describe my last problem
I have a list of items that I want to display and a div under the list allowing to diplay details about the item selected.
I'm trying to modify the template "seb-table" to match with my requirements.
The following code display the list of items (sorry for the indentation) :
<table id="list" <?php echo $class_table; ?>>
[.........]
<tbody>
<?php
$i = 0;
foreach ( $items as $item ) {
?>
<tr <?php echo ${'class_row'.($i % 2)}; ?> data-id="<?php echo $item->getValue('id'); ?>">
<?php
foreach ( $positions as $name=>$position ) {
$fieldnames = $cck->getFields( $name, '', false );
$multiple = ( count( $fieldnames ) > 1 ) ? true : false;
$html = '';
$width = '';
if ( $isFixed ) {
$width = $cck->w( $name );
$width = ( $width ) ? ' width="'.$width.'"' : '';
}
foreach ( $fieldnames as $fieldname ) {
$content = $item->renderField( $fieldname ); // todo: markup from $cck->renderField()
if ( $content != '' && ( $multiple || $item->getMarkup_Class( $fieldname ) ) ) {
$html .= '<div>'.$content.'</div>';
} else {
$html .= $content;
}
}
echo '<td'.$css[$name].$width.'>'.$html.'</td>';
}
?>
</tr>
<?php $i++; } ?>
</tbody>
</table>
It's the original code, I have not modified any line except the data-id attribute.
<tr <?php echo ${'class_row'.($i % 2)}; ?> data-id="<?php echo $item->getValue('id'); ?>">
Of course this function "getValue" does not work...
I would like to add a hidden attribute to read the id of the element when a user click on the table row.
I have done all the necessary stuff with JQUERY for the ajax part.
My only problem is to get the id value of the element displayed in the row.
I have no idea about the functions reachable with the variable $cck.
Declaration :
$cck = CCK_Rendering::getInstance( $this->template )= CCK_Rendering::getInstance( $this->template )
$items = $cck->getItems();
According to you, is it a simple way to get the id?
Important note: In the backend I did not load an id field, I would like to access to the column 'id' of the SQL table
Thanks a lot