How to get row/input field value of data loaded via ajax
How to get row/input field value of data loaded via ajax
Hi,
If you see my previous question here http://datatables.net/forums/discussion/28136/is-this-possible-and-do-i-need-editor - I was loading the data in to the DOM and then had to change it over to ajax as the dataset was too large. I insert an input box to get the "quantity" of the row and if the user changes the default value, i use a jquery hack to get the updated value (it's not pretty but it was working when I was loading to the DOM)
The problem I've now come across is that if the user selects records on different pages, i can't get the quantity using the jquery selector.
I get the data from:
var rows = oTT.fnGetSelectedData();
and it looks like this:
[00066234-716d-45f0-9d3b-1bc1d76de072,941001,GRAB BAR:SUPPLY 305MM STRAIGHT,<input type='text' style='width:50px' id='qty350' value='1' />,qty350,Cobalt Housing - Responsive (M),26/09/2014 21:40:02]
I get the quantity like this:
rows.forEach(function (rowItem) {
objSOR.sorID = rowItem[0];
qID = rowItem[4];
q = $('#' + qID).val();
objSOR.quantity = q;
It doesn't seem to work if they select a row on any other page than the first page - can anyone help with a better way to do this please?
I should say this is client side loaded ajax, not server side
Many thanks