Dataprovider for every NG Grid Cell?

Forum to discuss the new web client version of Servoy.

Dataprovider for every NG Grid Cell?

Postby john1598360627 » Wed Dec 08, 2021 2:21 am

The default behavior of the NG Grid is that we provide a dataprovider per column. Hence each row is one record from within the database.

Is there anyway of having a type of 'blank' grid where I can give each cell of the grid it's own dataprovider?

For example, creating a 7x6 grid and every cell is a different dataprovider..
john1598360627
 
Posts: 191
Joined: Tue Aug 25, 2020 3:03 pm

Re: Dataprovider for every NG Grid Cell?

Postby Gabi Boros » Wed Dec 08, 2021 9:19 am

you can't do that with NG Grids, but why would you want to use a table component in this case? Can't you just use
dedicated label/text field components for each cell?
Gabi Boros
Servoy
Gabi Boros
 
Posts: 418
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: Dataprovider for every NG Grid Cell?

Postby sean » Wed Dec 08, 2021 4:10 pm

Hi John,

To add to what Gabi says, this is not supported because Servoy grids (NG Grid and Table Component) are data-bound, so each row corresponding to a record in a data source.
Another approach could be to create an in-mem data source, populate with several empty records and bind that data source to a regular grid. Then when the user edits/saves, you transpose it back to your "real" data source. Would be a bit cumbersome, but you would get the desired effect in the UI.
Software Engineer
Servoy USA
sean
 
Posts: 383
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Dataprovider for every NG Grid Cell?

Postby john1598360627 » Wed Dec 08, 2021 11:40 pm

Gabi Boros wrote:you can't do that with NG Grids, but why would you want to use a table component in this case? Can't you just use
dedicated label/text field components for each cell?


The problem with the label/text field approach is I would have to make a style class for every part of this pseudo-table to make it in-line with the design document provided by our UX/Visual designer. Basically re-inventing what the grid already does, which already has a built-in theme. Also, for this to be done within 12grid.

sean wrote:Hi John,

To add to what Gabi says, this is not supported because Servoy grids (NG Grid and Table Component) are data-bound, so each row corresponding to a record in a data source.
Another approach could be to create an in-mem data source, populate with several empty records and bind that data source to a regular grid. Then when the user edits/saves, you transpose it back to your "real" data source. Would be a bit cumbersome, but you would get the desired effect in the UI.


Hmm I see, so the in-memory data source is a copy of the corresponding data sources. Then, when using the edit check the onDataChange to update the corresponding database sources.



I'll try and make my own table within 12grid containers and if it doesn't look right I'll try that in-mem method.
john1598360627
 
Posts: 191
Joined: Tue Aug 25, 2020 3:03 pm

Re: Dataprovider for every NG Grid Cell?

Postby swingman » Mon Dec 13, 2021 12:44 pm

in-memory data sources work great with grids, if the grid is read-only.

If the grid only needs occasional edits, you could attach a method to one of the grid events to pop up a form for editing the specific underlying data source, Servoy passes in record and column so you can work out where you are, and on save or close refresh the in-mem data source.
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1479
Joined: Wed Oct 01, 2003 10:20 am
Location: London


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 6 guests