Two tables that share the same data source!?

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

Two tables that share the same data source!?

Elhamer
Hello everybody,

How common is it for multiple tables (FastTables) to have the same datasource ?

The FTDataSource has a instance variable to refer a table:

````
Object subclass: #FTDataSource
        instanceVariableNames: 'table'
        classVariableNames: ''
        package: 'Morphic-Widgets-FastTable-DataSource'
```


which makes it impossible for several tables to have the same data source. the code of the data source is also coupled to the ft code which also makes it harder to extend.

I've tried to go down the rabbit hole and decouple the data source from the table but things went messy. So i would like to know how common it is for several tables to share the same ds, and does that worth going the extra mile ?

Thanks,
Elhamer.
Reply | Threaded
Open this post in threaded view
|

Re: Two tables that share the same data source!?

Aliaksei Syrel
Hello Elhamer,

Do you have an idea when it might be useful to have two lists representing the same datasource?
We have this feature in bloc (see video in attachment) but I didn't encounter a real-life use-case yet...

Cheers,
Alex
On 8 August 2017 at 02:16, Aliaksei Syrel <[hidden email]> wrote:
Hello Elhamer,

Do you have an idea when it might be useful to have two lists representing the same datasource?
We have this feature in bloc (see video in attachment) but I didn't encounter a real-life use-case yet...

Cheers,
Alex

On 8 August 2017 at 01:36, Elhamer <[hidden email]> wrote:
Hello everybody,

How common is it for multiple tables (FastTables) to have the same
datasource ?

The FTDataSource has a instance variable to refer a table:

````
Object subclass: #FTDataSource
        instanceVariableNames: 'table'
        classVariableNames: ''
        package: 'Morphic-Widgets-FastTable-DataSource'
```


which makes it impossible for several tables to have the same data source.
the code of the data source is also coupled to the ft code which also makes
it harder to extend.

I've tried to go down the rabbit hole and decouple the data source from the
table but things went messy. So i would like to know how common it is for
several tables to share the same ds, and does that worth going the extra
mile ?

Thanks,
Elhamer.



--
View this message in context: http://forum.world.st/Two-tables-that-share-the-same-data-source-tp4959153.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: Two tables that share the same data source!?

Elhamer
Hi Alex and thank you for your reply :))

Good to know that bloc already supports that, I am definitely moving to work on/with it after that :))

I've never encounter that scenario on a a Pharo package too, but since i was working on improving FTs, i thought why not!, besides, in apps with multiple tables, it might be handy to define a single large data source and assign columns to each table instead of defining a ds for each table, something like that:

````
        |pane table1 table2 ds|
ds:=FTCellSampleDataSource new:10.
table1 := FTTableMorph new
                extent: 500@500;
                selectionMode: #column;
                addColumn: (FTColumn id: 'column1');
                addColumn: (FTColumn id: 'column2');
                addColumn: (FTColumn id: 'column6');
                dataSource: ds;
                selectRowIndex: 1;
                showFirstRowSelection;
                beMultipleSelection;
                yourself.
table2 := FTTableMorph new
                extent: 500@500;
                selectionMode: #column;
                addColumn: (FTColumn id: 'column3');
                addColumn: (FTColumn id: 'column4');
                addColumn: (FTColumn id: 'column5');
                dataSource: ds;
                selectRowIndex: 1;
                showFirstRowSelection;
                beMultipleSelection;
                layoutInset: 10;
                yourself.
pane := Morph new.
pane layoutPolicy: TableLayout new.
pane listDirection: #leftToRight.
pane listCentering: #center.
pane wrapCentering: #center.
pane hResizing: #spaceFill.
pane layoutInset: 10@10.
pane cellInset:10@10.
pane color: Color red.

pane addMorph: table1.
pane addMorph: table2.
pane openInWindow .

```
 
Reply | Threaded
Open this post in threaded view
|

Re: Two tables that share the same data source!?

Stephane Ducasse-3
Hi Elhamer

where can we find the code of the improvements you did on FastTable?

Stef

On Tue, Aug 8, 2017 at 2:42 AM, Elhamer <[hidden email]> wrote:

> Hi Alex and thank you for your reply :))
>
> Good to know that bloc already supports that, I am definitely moving to work
> on/with it after that :))
>
> I've never encounter that scenario on a a Pharo package too, but since i was
> working on improving FTs, i thought why not!, besides, in apps with multiple
> tables, it might be handy to define a single large data source and assign
> columns to each table instead of defining a ds for each table, something
> like that:
>
> ````
>         |pane table1 table2 ds|
> ds:=FTCellSampleDataSource new:10.
> table1 := FTTableMorph new
>                 extent: 500@500;
>                 selectionMode: #column;
>                 addColumn: (FTColumn id: 'column1');
>                 addColumn: (FTColumn id: 'column2');
>                 addColumn: (FTColumn id: 'column6');
>                 dataSource: ds;
>                 selectRowIndex: 1;
>                 showFirstRowSelection;
>                 beMultipleSelection;
>                 yourself.
> table2 := FTTableMorph new
>                 extent: 500@500;
>                 selectionMode: #column;
>                 addColumn: (FTColumn id: 'column3');
>                 addColumn: (FTColumn id: 'column4');
>                 addColumn: (FTColumn id: 'column5');
>                 dataSource: ds;
>                 selectRowIndex: 1;
>                 showFirstRowSelection;
>                 beMultipleSelection;
>                 layoutInset: 10;
>                 yourself.
> pane := Morph new.
> pane layoutPolicy: TableLayout new.
> pane listDirection: #leftToRight.
> pane listCentering: #center.
> pane wrapCentering: #center.
> pane hResizing: #spaceFill.
> pane layoutInset: 10@10.
> pane cellInset:10@10.
> pane color: Color red.
>
> pane addMorph: table1.
> pane addMorph: table2.
> pane openInWindow .
>
> ```
>   <http://forum.world.st/file/n4959160/two_tables_single_ds.png>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Two-tables-that-share-the-same-data-source-tp4959153p4959160.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>