Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display two grids with different data on the same form

I have a form with two grids. I have one table with rows where each row has a status of Yes or No. I'd like to display all the yes's in the top and the no's in the bottom grid.

A similar scenario would be if I wanted to show SalesTable header records. The top grid would be only those with a status of Delivered, and the bottom grid those with a status of Invoiced.

How can I accomplish this?

I've gotten close by adding another datasource of the same table type. I add a QueryBuildRange to filter the records but I get two issues:

  1. When I click on a row in the top/bottom, it moves both row lines at the same time (the highlighting thing
  2. It wants to show an equal number of top rows as bottom rows for some reason?? If I have 3 delivered sales orders, and 5 invoiced sales orders, it will show 3 in the top and 3 in the bottom.
like image 813
Alex Kwitny Avatar asked Nov 21 '11 22:11

Alex Kwitny


1 Answers

Seams like the Grid-controls are being controlled by the same DataSource.
Check the properties of the Grid-control: make sure they are not set to the same DataSource!

Anyway, it would be helpful to know how the Form is structured and how the QueryBuildRange was added.

I created a very simple Form and it worked correctly:

  • added two Datasets with T-SalesTable each
  • added two Grid-controls to the Design (or to a TabPage, both worked)
  • adjusted the DataSource-property of each Grid to point to each DataSource
  • added fields (the AutoReport group) from the corresponding DataSource to each Grid

this one worked correctly (despite having the same contents. Then I

  • added a range in the init method of each of the Datasets

and it still worked.

enter image description here

like image 111
user85421 Avatar answered Sep 21 '22 07:09

user85421