jquery - var anSelected = fnGetSelected( oTable ) not executing -


var otable = $('#posgridview').datatable( { "bpaginate": false, "bfilter": false, "bsort": false, "binfo": false, "olanguage": { "szerorecords": "", "semptytable": "" }  } ); 

and

$("#posgridview tbody").click(function(event) { $(otable.fnsettings().aodata).each(function (){ $(this.ntr).removeclass('row_selected'); }); $(event.target.parentnode).addclass('row_selected'); }); 

the above code working fine, when select row , highlight. when press delete button , selected row not deleting.

$('#delete').click( function() { var anselected = fngetselected( otable ); otable.fndeleterow( anselected[0] ); } ); 

when put alert(anselected), come know statement var anselected = fngetselected( otable ); not executing.

there couple of things take account

  • you're selecting id on $('#delete'). far understand have delete button row having several elements same id. not allowed. add css class delete button (or use existing one) , select $('#posgridview .delete')

  • if you're adding rows dynamically, you'll need attach click event using on method. otherwise new added rows won't have click handler. code somethign $('#posgridview').on('click', '.delete', function(){...})


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -