1. Kanarie List Issue

Tommy, I apparently don't know how to use lists... Check this out and let me
know what I'm doing wrong... please! :)

In my program:

if length(dblist) > 0 then
 i = addListItem(data,"databases")
  for t=1 to length(dblist) do
   setValue(i,"dbname",dblist[t][D_NAME])
  end for
end if

In my KNR template:

{db_count=0:}
{:db_count=:}<p>Open Database ({db_count})</p>
	<ul id="navlist">
		{databases:}<li><a href="?dbopen={dbname}">{dbname}</a></li>{:databases}
	</ul>
{* list databases *}
{:db_count}


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Kanarie List Issue

cklester wrote:
> Tommy, I apparently don't know how to use lists... Check this out and let me
> know what I'm doing wrong... please! :)
> 
> In my program:
> 
> if length(dblist) > 0 then
>  i = addListItem(data,"databases")
>   for t=1 to length(dblist) do
>    setValue(i,"dbname",dblist[t][D_NAME])
>   end for
> end if
> 
> In my KNR template:
> 
> {db_count=0:}
> {:db_count=:}<p>Open Database ({db_count})</p>
> 	<ul id="navlist">
> 		{databases:}<li><a href="?dbopen={dbname}">{dbname}</a></li>{:databases}
> 	</ul>
> {* list databases *}
> {:db_count}

OK, I see what's happening. You only add 1 list-item, and then you set the
dbname-field for that item to different values. The 'addListItem' should be
inside the for-loop: for each 'database', you add an item to the list. Like
this:
if length(dblist) > 0 then
    for t = 1 to length(dblist) do
        i = addListItem(data, "databases")
        setValue(i, "dbname", dblist[t][D_NAME])
    end for
end if


--
The Internet combines the excitement of typing 
with the reliability of anonymous hearsay.

tommy online: http://users.telenet.be/tommycarlier
tommy.blog: http://tommycarlier.blogspot.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Kanarie List Issue

Tommy Carlier wrote:
> 
> OK, I see what's happening. You only add 1 list-item, and then you set the
> dbname-field for that item to different values. The 'addListItem' should be
> inside the for-loop: for each 'database', you add an item to the list.

Thanks Tommy. I got a little confused with your row/cell example. heheh.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu