Hello Tobias,

thanks for your reply. I've tried the addRows-Function before, but it did not 
work. It's a silly phenomenom, this code did not work (adds no empty row at the 
end of my table):

********************************************************************************************
(main-Function)

                        var tableModel = new qx.ui.table.model.Simple();
        
                        with (tableModel) {
                                setColumns([ "Ausgaben-Id",
                                                 ...
                                                 "Rechnung" ]);
                                                           
                                setColumnEditable(8, true);
                                ...
                        };
        
                        var tableExpenses = new qx.ui.table.Table(tableModel);
        
                        with (tableExpenses) {
                                set({ border:"inset-thin" });
                                
                                
getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_SELECTION);
                                
                                getTableColumnModel().setColumnVisible(0, 
false);
                                ...
                                
                                setColumnWidth(0, 0);
                                ...
                                setColumnWidth(9, 150);
                                ...
                                
                                setWidth(1430);
                        };

                        I'VE SHORTENED THE TABLMODEL AND TABLE DEFINITIONS A 
BIT, REAL SOURCE CONTAINS WHOLE
                        CODE FOR ALL 21 COLUMNS
                        
                        this.fillExpensesTable(pid, tcid, tableModel);
                        
                        var emptyRow = new 
Array("","","","","","","","","","","","","","","","","","","","","");
                        var wrapper = new Array(emptyRow);
                        tableExpenses.getTableModel().addRows(wrapper);
                        
(end of main function)

        fillExpensesTable : function(pid, tcid, tableModel) {

                try
                {
                        //tableModel.removeRows(0, tableModel.getRowCount());

                        var req = new 
qx.io.remote.Request("http://devserver/projectdetail/costs_report/source/costs_report_backend.php","GET","text/plain";);
                        req.setParameter("p_id", pid);
                        req.setParameter("tc_id", tcid);
                        req.setParameter("action", "GetExpensesList");
                        req.setTimeout(10000);
                        req.addEventListener("completed", function(e){
                                try
                                {
                                        var content = e.getContent();

                                        if (content.length > 0)
                                        {
                                                var tabledata = 
qx.io.Json.parse(content);
                                                tableModel.setData(tabledata);
                                        }
                                }
                                catch (ex)
                                {
                                        alert("Fehler bei Erhalt der 
Tabellendaten: " + ex.toString());
                                }
                        });

                        req.send();
                }
                catch(ex)
                {
                        alert("Fehler bei Anforderung der Tabelle: " + 
ex.toString());
                }
        },
********************************************************************************************

while this works:

********************************************************************************************
(main-Function)

                        SAME AS ABOVE UNTIL HERE                        
                        
                        this.fillExpensesTable(pid, tcid, tableModel);
                        
(end of main function)

        fillExpensesTable : function(pid, tcid, tableModel) {

                try
                {
                        //tableModel.removeRows(0, tableModel.getRowCount());

                        var req = new 
qx.io.remote.Request("http://devserver/projectdetail/costs_report/source/costs_report_backend.php","GET","text/plain";);
                        req.setParameter("p_id", pid);
                        req.setParameter("tc_id", tcid);
                        req.setParameter("action", "GetExpensesList");
                        req.setTimeout(10000);
                        req.addEventListener("completed", function(e){
                                try
                                {
                                        var content = e.getContent();

                                        if (content.length > 0)
                                        {
                                                var tabledata = 
qx.io.Json.parse(content);
                                                tableModel.setData(tabledata);

                                                var emptyRow = new 
Array("","","","","","","","","","","","","","","","","","","","","");
                                                var wrapper = new 
Array(emptyRow);
                                                tableModel.addRows(wrapper);    
                                }
                                }
                                catch (ex)
                                {
                                        alert("Fehler bei Erhalt der 
Tabellendaten: " + ex.toString());
                                }
                        });

                        req.send();
                }
                catch(ex)
                {
                        alert("Fehler bei Anforderung der Tabelle: " + 
ex.toString());
                }
        },
********************************************************************************************

So if i add the empty row within the fillExpensesTable-Function which populates 
the result from my backend script (database) the row was added
correctly. If i try to add the row afterwards in the main, the row was not 
added, no matter if i use the tableModel-variable or 
"tableExpenses.getTableModel()".

When i type "this.tableExpenses.getTableModel()" i've got an error saying that 
tableExpenses has no properties...

I am a bit confused, why does the first one not work?

BTW: Thanks for the 29, i wish it would be real... ;-)

Thanks again and kind regards,
-- 
Andreas Tepper
Softwareentwicklung

Animationsfabrik GmbH
Donnerstrasse 20
D-22763 Hamburg

Tel:    +49 40 398415-10
Fax:    +49 40 398415-32
E-Mail: [EMAIL PROTECTED]
Web:    www.animationsfabrik.de  

Amtsgericht Hamburg
HRB 75488
Geschäftsführer: Jörn Radel
Sitz der Gesellschaft: Hamburg
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tobias Koller 
(GERMO GmbH)
Sent: Friday, December 14, 2007 7:26 AM
To: qooxdoo Development
Subject: Re: [qooxdoo-devel] Add New Row

Hi andreas,

Here is an example:

if you have the following columns: id|name|firstname|age|hobby


var row = new Array("1","Tepper", "Andreas", "29", "programmingQooxdoo");

mytable.getTableModel().addRow(row);


if you don't want to fill this fields you can also just make something like:
var row = new Array("","", "", "", "");


I didn't try it out but that should work.

Tobias


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Andreas Tepper
Gesendet: Donnerstag, 13. Dezember 2007 14:04
An: qooxdoo-devel@lists.sourceforge.net
Betreff: [qooxdoo-devel] Add New Row

Hi,

i have a table (qx.ui.table.Table(tableModel) where tableModel is 
qx.ui.table.model.Simple()) which is partly editable by the user. Also users 
should be able to add new rows to the table. In other GUI-Environments, like 
the DataGridView from MS .Net-Framework Forms, you have a special "last row" 
which is empty to add a row to the table (nomrally marked with * in the 
row-header, i think you all know what i mean). 

How could i achieve this with qooxdoo-Tables? Another question is, if it is 
possible to provide such a "add new row row", how to set up default values, 
e.g. for columns the user must not or do not want to edit?

It would be highly appriciated if somebody has a piece of sample-code regarding 
these matters.

Thanks for your help & kind regards,
-- 
Andreas Tepper
Softwareentwicklung

Animationsfabrik GmbH
Donnerstrasse 20
D-22763 Hamburg

Tel:    +49 40 398415-10
Fax:    +49 40 398415-32
E-Mail: [EMAIL PROTECTED]
Web:    www.animationsfabrik.de  

Amtsgericht Hamburg
HRB 75488
Geschäftsführer: Jörn Radel
Sitz der Gesellschaft: Hamburg

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to