[Pharo-dev] Two tables that share the same data source!?

Elhamer abdelkhalekdev at gmail.com
Mon Aug 7 20:42:47 EDT 2017


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 at 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 at 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 at 10. 
pane cellInset:10 at 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.



More information about the Pharo-dev mailing list