Displaying datasets on multiple tabpanels

Questions and answers for designing and implementing forms in Servoy

Displaying datasets on multiple tabpanels

Postby wes.s.grayson » Thu Nov 01, 2012 7:59 pm

I have a form with two tab panels. Each tab panel references the same datasource\table, but two different forms, so that they can be displayed with slightly different fields and a different dataset. For example, on my form, I want users to be able, in one tab panel, to see all the records that are "expiring" in the next 30 days. In a seperate tab panel, I want users to be able to view see all the records that are "assigned" to them.

I can query the records and display the dataset correctly for either of these two scenarios, but when one tabpanel is loaded with a dataset, it changes the other tabpanel to that same dataset. How can I display different datasets of the same table on a single form?

Code: Select all
//find and load records into the first tabpanel
var user = globals.currentUser   
var query = "SELECT sir_id FROM aissp WHERE assigned = ? ORDER BY is_num";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(),query, [user],maxReturnedRows);
forms.form1.controller.loadRecords(dataset);

//find and load records into the second tabpanel
var date = new Date();
var query2 = "SELECT sir_id FROM aissp WHERE expiration < ? ORDER BY expiration";
var dataset2 = databaseManager.getDataSetByQuery(controller.getServerName(),query2, [date],maxReturnedRows);
forms.form2.controller.loadRecords(dataset2);
wes.s.grayson
 
Posts: 46
Joined: Mon Jan 23, 2012 5:39 pm

Re: Displaying datasets on multiple tabpanels

Postby ROCLASI » Thu Nov 01, 2012 9:16 pm

Hi Wes,

You need to set the namedFoundset form property of (at least one of) the form(s) to 'Seperate'.
Else both will use the same (shared) foundset and whatever you do on the first form will reflect in the other.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Displaying datasets on multiple tabpanels

Postby wes.s.grayson » Thu Nov 01, 2012 10:37 pm

perfect, thanks!
wes.s.grayson
 
Posts: 46
Joined: Mon Jan 23, 2012 5:39 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 12 guests