On Sep 11, 2010, at 6:12 PM, Stanislav Colotinschi wrote:

> Hi. As I am new on the mailing list, I would like to thank you for such 
> a great framework. And here's the situation: I have a page-framed 
> database app. On the first page I have a grid displaying all the records 
> in a table of my PgSQL database, and a button, which onHit method is the 
> following:
> 
> def onHit(self, evt):
>     clDS = self.Form.getBizobj(dataSource="public.clients").getDataSet()
>     ds = clDS.filter('balance',0,'gt')
>     self.Form.cltable.buildFromDataSet(ds)
> 
> I found some info about it in wiki, I tried it, and I almost liked the 
> solution. But there's a problem: the records' columns are displayed 
> twice (or almost twice), that is, I have one record, which has not 8 
> (like in original view with the default datasource), but 16 columns in a 
> row. I would like to find answers to two questions:
> 1) How can I fix it?
> 2) Is there a possibility to clear the dGrid before displaying on it 
> something else? Maybe there is an event or something.

        I"m not sure exactly what you're trying to do, but it sounds like 
you're doing too much. If I read you correctly, you want the grid to only show 
records with a positive balance after the user clicks the button.

        First, I would make sure that the grid's DataSource is "public.clients" 
(I'm not sure if you even need to specify the 'public' part). I'd set the 
ColumnCount of the grid to 8, and set the DataField for each of the columns to 
the name of the column from the table it should display.

        That makes the button's action very simple:

def onHit(self, evt):
        grd = self.Form.cltable # I'm assuming that this is a reference to the 
grid
        biz = self.Form.getBizobj(grd.DataSource)
        biz.filter("balance", 0, "gt")
        grd.update()

        When you use Dabo's data binding (i.e., DataSource and DataField), the 
communication between the control and the bizobj is handled for you by the 
framework. By calling the grid's update() method, you're telling it to grab the 
current data in its DataSource and display it. The framework handles the rest!

        Let me know if you have any other questions.



-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to