On Sat, Nov 22, 2014 at 5:07 PM, Björn Lundin <b.f.lun...@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Having a table
>
>   Result_Table  : Gnoga.Gui.Element.Table.Table_Type;
>
> How do I empty it?
>

The quickest would be Result_Table.Inner_HTML(""); That would remove all
child elements of Result_Table from the browser and you could then just add
new ones.

Keep in mind that the Ada object will not finalize just because you cleared
the elements from the browser.

So let's say you were doing everything dynamically. You could do
Result_Table.Remove then Result_Table.Free (which will also free all
children set dynamic), then create a new Result_Table := new Table_Type and
start again.

If you are not going to set any handlers on the table elements you could
also do everything static and just let the child elements of the table
finalize right after creating them (this doesn't remove them from the DOM,
you just have no more access to them unless you "attach" to them again).

At library level:
  Result_Table  : Gnoga.Gui.Element.Table.Table_Type;

Say in some procedure Fill_Me.

Row : Table_Row_Type;
...
for i in 1 .. Last_Result loop
   declare
      Col : Table_Column_Type;
   begin
      Col.Create (Row, Result (i));
   end;
end loop;

Then you can use the Result_Table.Inner_HTML (""); to erase the children in
the DOM and start over and call Fill_Me again.



> I then tried
>   View.Result_Table.Remove;
>   View.Result_Table.Create (View);
>

Create in the above code is invalid, i.e. View.Result_Table exists, in this
case in the browser (although not in the DOM) and on the Ada side.

Remove removes the entire table element from the DOM but it still exists in
the browser's "gnoga cache". You could put it back using View.Result_Table
with Place_Inside_Top_Of, Place_Inside_Botton_Of, Place_Before, or
Place_After. All the children would also be put back as well and as long as
the Ada objects used to create them are still around you can access those
elements if they are in the DOM or not.

David Botton
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to