[Seaside] TableSelectable

Cédrick Béler cbeler at enit.fr
Fri Oct 20 12:50:29 UTC 2006


>  
>
> I subclassed WACanvasTableReport and added some stuff.  My table works 
> now except that I need to reload the page after the onClickCallback of 
> the table row
>
>  
>
>  
>
>             html tableRow style: 'background-color: ', (self 
> colorForRowNumber: index);
>
>                         onMouseOver: 
> 'javascript:highlightTableRow(this, "' , self highlightColor , '");';
>
>                         onClickCallback: [self selectRow: index.];
>
I did something like that:

WACanvasTableReport>>renderRowNumber: index item: row on: html
    html tableRow
        class: 'rowTable';
        class: 'row', (self codeForRowNumber: index);
        id: 'row', index asString;
        onClick: (html updater
            id: 'row', index asString;
            callback: [:rend | self selectRow: index. self 
renderColumnsRow: row on: rend ]);
        with: [ self renderColumnsRow: row on: html]

WACanvasTableReport>>renderColumnsRow: row on: html

    columns do: [ :each | self renderColumn: each row: row on: html]

The problem I have is that clicking on the row allows to select (or 
whatever else) but if you click on a data (table cell) that has an 
anchor (or action) associated to it, then the selection is also done 
which is not always what we want. I don't know how to avoid that.


WACanvasTableReport>>style
| string |
    string := '.rowTable:hover { background: ', hoverColor asString  ,';}'.
    rowColors withIndexDo: [:elem :index |
        string := string , '
.row', index asString, ' { background-color: ', elem, ';}'].
    ^string

 Also, generating the style method is not good I think, as if you try to 
edit it through the seaside interface, it will blow the code away.     

Cédrick




More information about the Seaside mailing list