[Kss-devel] insertHTMLAsFirstChild with tables
Ramon Bartl
ramon_bartl at yahoo.de
Fri Jun 20 15:50:28 CEST 2008
Am 20.06.2008 um 15:37 schrieb Godefroid Chapelle:
> Ramon Bartl wrote:
>>> Ramon Bartl wrote:
>>>> Hi Godefroid,
>>>>> I have no magic wand for you now ;-)
>>>> It's a pity;)
>>>>> I think we will need to quit using innerHTML and go back to DOM
>>>>> construction.
>>>>>
>>>>> I am afraid that in the meanwhile, you'll need to refresh the
>>>>> full table :-S
>>>> I'm using now div boxes to do the work, there it works fine:)
>>> Much better, except when table is semantically needed !
>> A table would actually fit better, because I'm trying to display
>> test results which have columns like:
>> number, tests ok, tests failed, total time
>> so I have to do some css magic now to display the test results
>> exactly among each other....
>> .... but I have another question, if this is allowed in the kss
>> developer list (probably more a plone users question):
>> I made a <div> container which gets periodically filled with job
>> results.
>> the HTML looks like this:
>> -----------------------------------------------------------------------
>> <div id="job-container">
>> <div class="job">some job results</div>
>> <span id="last-node" />
>> </div>
>> -----------------------------------------------------------------------
>> The KSS looks like this:
>> -----------------------------------------------------------------------
>> #job-container:timeout {
>> evt-timeout-delay: 3000;
>> evt-timeout-repeat: True;
>> action-server: live_kss;
>> }
>> ------------------------------------------------------------------------
>> so every 3 seconds my live_kss gets called which inserts a new
>> <div> as the first child into my job-container:
>> Finally, here my question:
>> Is it possible in KSS to count the child elements of my job-
>> container to prevent an overflow?
>> Maybe after 5 childs have been added to the container, we start to
>> delete the last child for every new child added?
>> something like:
>> <PSEUDO CODE>
>> if ksscore.countNodes(ksscore.getHtmlIdSelector('job-container')) >
>> 5:
>> ksscore.deleteNodeBefore(
>> ksscore.getHtmlIdSelector('last-node'))
>> </PSEUDO CODE>
>> Thanks a lot and sorry if this question don't fits into this
>> mailing list
>
> It does fit very well the list.
>
> With KSS, the server should always be in charge; the client is a
> view of the server.
>
> IOW, the server-side should maintain the number of divs and send
> back a delete command when it knows it has sent two many divs;
Thanks Godefroid for the fast reply:) I made it now quite simple, I
simply added empty div's at the end of my template;)
<div id="job-container">
<div class="job">some job results</div>
<div></div>
<div></div>
<div></div>
<div></div>
<span id="last-node" />
</div>
so I have stack hight of 5 items and can remove always the last node
when I add one....
Maybe some kind of MacGyver solution, but works fine:)
cheers
ramonski
More information about the Kss-devel
mailing list