I'm trying to pass back a DIV element using Ajax function, the flow works,
but the argument is not returned into the request.vars.
Using Ajax() on another view works well for me.
*The scenario:*
- SQLFROM.grid element is displayed in the view.
- When a row is clicked, I'm:
- capturing the event,
- getting the row's first cell value,
- setting the value into a hidden div (selected_job) (work around not
being able to pass value back by Ajax())
- Using Ajax() calling back and passing the selected_job element.
*View:*
{{extend 'layout.html'}}
<script type="text/javascript">
$(document).ready(function(){
$("tr").click(function(){
var sid = $(this).find('td').eq(0).text();
$(selected_job).text(sid);
ajax('update_job_items', ['selected_job'], 'job_items_grid');
});
});
</script>
<div id='selected_job' class='hidden'>-1</div>
{{=jobs}} <!-- Displays an SQLFORM.grid -->
<div id='job_items_grid' ></div>
*Controller:*
def update_job_items():
print request.vars # ==> <Storage {}> empty....
item_id = request.vars.selected_job # item_id ==> NoneType: None
return DIV('Done')
The above flow works, values are captured correctly, *update_job_items**()*is
called but
*request.vars* is empty from any element
An advice will be greatly appreciated.
Yuval
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.