Wednesday, 19 November 2014

Getting JQuery Datatable data

//JQuery table whole data getting
<script>
    $(function() {
        var table = $('#dueList').dataTable();
        $('#printBtn').hide();
//Click On Print
$('#printBtn').click(function(){
var feeList = [];
$('[name="syllabus"]').val($('#selectedBoard option:selected').text());
$('[name="class"]').val($('#selectedClass option:selected').text()+' & '+$('#sectionCombo option:selected').text());
$(table.fnGetNodes()).each(function(i){
var record = new Object();
record.admissionNo = table.fnGetData(i)[0];
record.name = table.fnGetData(i)[1];
record.defaultFee = table.fnGetData(i)[2];
record.extraFee = table.fnGetData(i)[3];
record.transportFee = table.fnGetData(i)[4];
record.total = table.fnGetData(i)[5];
record.paid = table.fnGetData(i)[6];
record.concession = table.fnGetData(i)[7];
record.due =$(table.fnGetData(i)[8]).text();
feeList.push(record);
});
$('[name="dueList"]').val(JSON.stringify(feeList));
});

//Validations
if(parseInt($('[name="listSize"]').val()) > 0 ) $('#printBtn').show('fade');

    });
</script>

No comments:

Post a Comment