Forum
01:09
20/05/2013
Hi all,
I'm currently trying to fill a column with different icons that each have javascript code to execute when they get clicked.
Coding the part to show the other columns was easy.
However for these actions the xml is formed as follows(note that the parts with tmpl are actually parsed on the server side to fill in the xml; this just shows the structure; there can be different actions for different transfers):
<?xml version='1.0' encoding='utf-8'?>
<transferslisting>
<page><tmpl_var name="transferlist_page"></page>
<total><tmpl_var name="transferlist_total_pages"></total>
<records><tmpl_var name="transferlist_count"></records>
<transfers>
<tmpl_loop name="transferlist_torrents">
<transfer id='<tmpl_var name="url_entry">'>
<details><![CDATA[ <tmpl_var name="details_action"> ]]></details>
<path><![CDATA[ <tmpl_var name="url_path"> ]]></path>
<name><![CDATA[ <tmpl_var name="displayname"> ]]></name>
<uprate><tmpl_var name="up_speed"></uprate>
<downrate><tmpl_var name="down_speed"></downrate>
<owner> <tmpl_if name="is_owner"> <![CDATA[ images/checked.png ]]>
<tmpl_else> <![CDATA[ images/edit.png ]]></tmpl_if>
</owner>
<percentage><tmpl_var name="percentage"></percentage>
<status><![CDATA[ <tmpl_var name="statusStr"> ]]></status>
<size><tmpl_var name="format_af_size"></size>
<eta><![CDATA[ <tmpl_var name="esttime"> ]]></eta>
<actions>
<tmpl_loop name="transfer_actions">
<action>
<script><![CDATA[<tmpl_var name="action_name">]]></script>
<script><![CDATA[<tmpl_var name="image">]]></script>
<image><![CDATA[<tmpl_var name="script">]]></image>
</action>
</tmpl_loop>
</actions>
</transfer>
</tmpl_loop>
</transfers>
</transferslisting>
The important element is "action". So in the last column I want that for each action in the actions element, some html code is generated with a clickable image. I would expect that I have to use a formatter on the "actions" element. Or does it has to be on the "action" element? Furthermore, how do I loop through them? Do I just pick the cellValue that is passed to the formatter and start parsing (with some xml parsing code or just some fiddling around with strings)?
I have to admit that I don't have experience with parsing xml.
Any help is greatly appreciated!
02:16
20/05/2013
I'm currently trying something like this (with a formatter on the actions xml mapping):
function formatActions(cellValue, options, rowObject) {
actions = $('actions', rowObject);
output = "";
$('action', actions).each(
function(i) {
actionName = $(this).find("action_name").text();
image = $(this).find("image").text();
script = $(this).find("script").text();
output += actionName + " ";
}
);
return output;
}
However this fails. I don't get into the function(i).
When I step through the code I actually get on the function(i) line, however no code inside it is executed.
It then goes just to the return line.
Most Users Ever Online: 715
Currently Online:
47 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66