Sunday, October 17, 2021

Edit data from django-ajax-datatable

Dear Team,

I am using django-ajax-datatable and I have this:


The Edit button is added from server side as follow: 
def customize_row(self, row, obj):
row['edit'] = """
<a href="#" class="btn btn-success btn-edit"
onclick="var id=this.closest('tr').id.substr(4); alert('Editing Input number: ' + id); return false;">
Edit
</a>
"""

the table itself is rendered to html from:

<script language="javascript">

$(document).ready(function() {
AjaxDatatableViewUtils.initialize_table(
$('#datatable_membership'),
"{% url 'ajax_datatable_membership' %}",
{
// extra_options (example)
processing: true,
autoWidth: false,
full_row_select: true,
scrollX: false
}, {
// extra_data

},
);

});

</script>

when you click the edit button there is an alert showing the ID of the record.

Then, from the code above, what can I do such that when I click on the Edit button the new window of the clicked ID is showing out so that I can edit the record? 


Thank you for the help

regards, 
--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHsm%3DBM%3DL%2B5fX1a09Ew8O0nqyYGBh%2BeAFQuALBpgtPMqfA%40mail.gmail.com.

No comments:

Post a Comment