TableSelectable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

TableSelectable

Ron Teitelbaum

Hi all,

 

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.];

                        with: [columns

                                                do: [:ea | self

                                                                        renderColumn: ea

                                                                        row: row

                                                                        on: html]]

 

Is there a way to reload the page from a callback?  I know I can do it on liveCallback but tableRow’s do not understand liveCallback.

 

Thanks for your help!

 

Ron Teitelbaum


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: TableSelectable

cbeler
Hi

maybe with submitOnClick...

or onClick: 'submit()'...

but it's not directly in the callback and it does a full refresh of the
page.

Otherwise you could use scriptaculous updater's by adding having
something like:

html tableRow...
onClick: (html updater
id:'fullTable'
callback: [:rend | self selectRow: index. self renderTableOn: rend])
with:[...]


or maybe...

rowId := html nextId.
html tableRow...
id: rowId;
onClick: (html updater
id: rowId;
callback: [:rend | self selectRow: index. self renderRow: aRow On: rend])
with:[...]


Never tried with tables though...

See you

Cédrick

> Hi all,
>
> 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.];
>
> with: [columns
>
> do: [:ea | self
>
> renderColumn: ea
>
> row: row
>
> on: html]]
>
> Is there a way to reload the page from a callback? I know I can do it
> on liveCallback but tableRow’s do not understand liveCallback.
>
> Thanks for your help!
>
> Ron Teitelbaum
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: TableSelectable

cbeler
In reply to this post by Ron Teitelbaum

>  
>
> 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


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: TableSelectable

cbeler

> 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.
>
I solved that with a default onClick (to select the row) on table cells
of the row that have no clickAction associated to it. It works nice.

But do you know, if there is a possibility (CSS or javascript) to
dissable a parent action.
For instance, we associate a onClick: action that selects the row (add
it in a selection var) ans one cell contains an anchor. Is it possible
to click on the anchor, without selecting the row ?


Thanks

Cédrick
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: TableSelectable

Lukas Renggli
> For instance, we associate a onClick: action that selects the row (add
> it in a selection var) ans one cell contains an anchor. Is it possible
> to click on the anchor, without selecting the row ?

With Scriptaculous for Seaside:

    onClick: (the handler action ...) , SUEvent new stop

HTH,
Lukas


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: TableSelectable

Ron Teitelbaum
In reply to this post by cbeler
Hi Cédrick,

I think it is possible if you return false from onClick attached to an
anchor on the link.

<a ... onClick: "document.location='...'; false">  This would stop the
onClick from executing in the table row.

Could you give me some more info on what you did for default click?

Ron





> From: Cédrick Béler
> Sent: Monday, October 23, 2006 6:35 AM
>
>
> > 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.
> >
> I solved that with a default onClick (to select the row) on table cells
> of the row that have no clickAction associated to it. It works nice.
>
> But do you know, if there is a possibility (CSS or javascript) to
> dissable a parent action.
> For instance, we associate a onClick: action that selects the row (add
> it in a selection var) ans one cell contains an anchor. Is it possible
> to click on the anchor, without selecting the row ?
>
>
> Thanks
>
> Cédrick
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: TableSelectable

cbeler
Hi
> Hi Cédrick,
>
> I think it is possible if you return false from onClick attached to an
> anchor on the link.
>
> <a ... onClick: "document.location='...'; false">  This would stop the
> onClick from executing in the table row.
>  
I'll try that and also what Lukas answered (...onClick: (the handler
action ...) , SUEvent new stop )...but later ;)
> Could you give me some more info on what you did for default click?
>
>  
I sublclassed WACanvasTableReport to have a "live" table report (using
scriptaculous).

I added 3 inst var:
- highlightColor
- selection to store the selected object represented as rows,
- actionBlock to perform an action on the selection (In my case, I
display the selection in another table)

I also added an instVar hiddenBlock in WAColumn (actually a subclass) to
show/hide columns (depending of the user status).

Actions in the table are call/answer whereas sorting (clicking header),
selection (clicking on a row or a check box), and display of the action
button is live. I will add a batch soon and filters on each columns.

I joined .st files if you want to have a look but this is not really
nice code ;) ...

See you

Cédrick

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

SUReportColumn.st (838 bytes) Download Attachment
SULiveTableReport.st (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: TableSelectable

Ron Teitelbaum
Thanks Cédrick!

Ron


> From: Cédrick Béler
> Sent: Monday, October 23, 2006 10:48 AM
>
> Hi
> > Hi Cédrick,
> >
> > I think it is possible if you return false from onClick attached to an
> > anchor on the link.
> >
> > <a ... onClick: "document.location='...'; false">  This would stop the
> > onClick from executing in the table row.
> >
> I'll try that and also what Lukas answered (...onClick: (the handler
> action ...) , SUEvent new stop )...but later ;)
> > Could you give me some more info on what you did for default click?
> >
> >
> I sublclassed WACanvasTableReport to have a "live" table report (using
> scriptaculous).
>
> I added 3 inst var:
> - highlightColor
> - selection to store the selected object represented as rows,
> - actionBlock to perform an action on the selection (In my case, I
> display the selection in another table)
>
> I also added an instVar hiddenBlock in WAColumn (actually a subclass) to
> show/hide columns (depending of the user status).
>
> Actions in the table are call/answer whereas sorting (clicking header),
> selection (clicking on a row or a check box), and display of the action
> button is live. I will add a batch soon and filters on each columns.
>
> I joined .st files if you want to have a look but this is not really
> nice code ;) ...
>
> See you
>
> Cédrick

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside