简体   繁体   中英

JavaScript runtime error during DataTables rowReordering (ASP.Net MVC)

I'm using the following jQuery to initialize DataTables .

<script type="text/javascript">
    $(document).ready(function() {
        $('#GenderIndex').dataTable().rowReordering({ sURL: "/GenderDD/UpdateRow" });
    });
</script>

During drag and drop (Reordering) I'm getting the following error message:

0x800a139e - JavaScript runtime error: Syntax error, unrecognized expression: #

You can find the rowReordering plugin Here .


  1. I really don't understand this error message

  2. Has anyone ever used rowReordering with the latest DataTables version?

  1. The error " unrecognized expression: # " means that you not have defined an indexing column. The RowReordering plugin needs a column with unique numbers it can populate to the <tr> 's as id 's it then use to distinguish between rows. You have no such column, therefore this plugin tries to perform an #id selector without id - $("#") .

  2. You need to use the new RowReorder plugin if you want to have RowReordering in dataTables 1.10.x -> http://cdn.datatables.net/#RowReorder fiddle here -> http://jsfiddle.net/006d4of9/ . The new and better plugin is more flexible but still needs an indexing column - it does not throw errors if you have forgotten to define one, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM