asp.net mvc - Datatables for Visual Studio 2012 MVC project -
i have datatable build in jquery. declaration looks like:
otable = $('#rules-datatable').datatable({ "aocolumns": [ { "mdataprop": [0], "swidth": "10%" }, { "mdataprop": [1], "swidth": "10%" }, { "mdataprop": [2], "swidth": "10%" }, { "mdataprop": [3], "swidth": "10%" }, { "mdataprop": [4], "swidth": "10%" }, { "mdataprop": [5], "swidth": "10%" }, { "mdataprop": [6], "swidth": "10%" }, { "mdataprop": [7], "swidth": "10%" }, { "mdataprop": [8], "swidth": "10%" }, { "mdataprop": [9], "swidth": "10%" } ], "bautowidth": true, "bfilter": false, "blengthchange": false, "bprocessing": true, "bserverside": true, "bsort": false, "idisplaylength": 50, "sajaxsource": '@url.action("getallcapturedrules")', "fndrawcallback": function (osettings) { if (navigator.useragent.tostring().indexof('msie') >= 0) { // fixes ie8 overflow issue. style added after datatable has been drawn. $('#main').addclass('overflow-fix'); } } });
i trying values of selected row after click event, doesn't seem work. click event follows:
otable.click(function () { var anselected = otable.$('tr.row_selected'); if (anselected.length == 0) { alert('please make selection'); } else { // data selected row } }
on click event displays 'please make selection', never gets value of selected row. can please explain why, , how work around this? using datables v 1.9.1
the following add click event each table row
otable.$("tr").on("click", function(){ //tr clicked, can information rowclicked var rowclicked = $(this); });
is looking for?
Comments
Post a Comment