Andriyko
unread,Dec 19, 2012, 1:34:33 PM12/19/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hello dear Django Users!
I'm trying to use django inclusion_tag or/and assignment_tag with jquery 'onclick' event.
Encountered such problems:
1. When using inclusion_tag/assignment_tag the content returned by them is rendered on page load, not onclick.
And I suspect that it is correct behavior, once the tag is met it is rendered by template render. So, I think that should be some way to skip django tags? How?
2. With inclusion_tag the result returned by tag is shown in the place where it was called, not where it is 'intended' to be.
And again, I think it is correct. But how to use inclusion_tag really onclick event?
For example,
-------------------
<script>
$(function() {
var result = $("#select-result").empty();
$('#myid').somecontainer({animate:true,
onClick: function(node){
result.html('{% my_inclusion_tag "param1" "param2" %}');
}
});
});
</script>
-------------------
As the result(in source of loaded page) I have content returned by inclusion_tag inside <script></script>, not under #select-result div.
Like
...
onClick: function(node){
result.html(<table>lalalala</table>);
}
...
The code that works as expected :), onclick not onload.
<script>
$(function() {
var result = $("#select-result").empty();
$('#myid').somecontainer({animate:true,
onClick: function(node){
alert(node.text);
}
});
});
</script>