Uncaught TypeError : Cannot read property 'mData' of undefined

Uncaught TypeError : Cannot read property 'mData' of undefined

doodlekanadoodlekana Posts: 4Questions: 0Answers: 0
edited April 2014 in General
This is mvc 4 application with razor view. I made sure only single instance of jquery is loaded. BTW is jquery 1.9.0 compatible with dataTables 1.1 beta? This is my first time using dataTable.
[code]


head1
head2
head3
head4

@foreach (var item in Model)
{

@item.data1
@item.data2
@item.data3
@item.data4

}





$(document).ready(function () {
$("#studenttable").dataTable();
}
)


[/code]

Replies

  • doodlekanadoodlekana Posts: 4Questions: 0Answers: 0
    I just tried jquery 1.11 that came with the download example and the problem is still happenning, I do not think it is a jquery version problem.
  • doodlekanadoodlekana Posts: 4Questions: 0Answers: 0
    I also tried using the older version 1.9.4 and getting error Uncaught TypeError: Cannot read property 'asSorting' of undefined.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    > BTW is jquery 1.9.0 compatible with dataTables 1.1 beta?

    Yes. jQuery 1.7+.

    Regarding the issue, please link to a test case showing the issue so I can debug it and help to resolve it.

    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Oh - I've just realised you don't have a thead and tbody...

    See the "Prerequisites" section here: http://datatables.net/usage/

    Allan
  • doodlekanadoodlekana Posts: 4Questions: 0Answers: 0
    Thanks allan. I did miss out thead and tbody.
  • RodoBartRodoBart Posts: 1Questions: 0Answers: 0

    Hola que tal, yo tambien tengo el mismo problema, como podría solucionarlo, ayuda!

    <asp:ListView ID="lvDatos" runat="server" DataKeyNames="espe_id" OnItemCommand="lvDatos_ItemCommand">
    <LayoutTemplate>
    <table id="grid" class="table table-condensed table-bordered table-hover">
    <thead>
    <tr>
    <th>
    #
    </th>
    <th>
    NOMBRE DE LA ESPECIALIDAD
    </th>
    <th>
    SIGLA
    </th>
    <th>
    CLAVE
    </th>
    <th class="hide">
    ID COORD
    </th>
    <th>
    COORDINACION
    </th>
    <th colspan="2">
    </th>
    </tr>
    </thead>
    <tbody>
    <tr runat="server" id="itemPlaceholder" />
    </tbody>
    </table>
    </LayoutTemplate>
    <ItemTemplate>
    <tr>
    <td>
    <%# Container.DataItemIndex + 1 %>
    </td>
    <td>
    <asp:Literal ID="ltlNombreEspecialidad" runat="server" Text='<%# Eval("espe_nombre")%>' />
    </td>
    <td>
    <asp:Literal ID="ltlSiglaEspecialidad" runat="server" Text='<%# Eval("espe_sigla")%>' />
    </td>
    <td>
    <asp:Literal ID="ltlClaveEspecialidad" runat="server" Text='<%# Eval("espe_clave")%>' />
    </td>
    <td class="hide">
    <asp:Literal ID="ltlIdCoordinacion" runat="server" Text='<%# Eval("coord_id")%>' />
    </td>
    <td>
    <asp:Literal ID="ltlNombreCoordinacion" runat="server" Text='<%# Eval("coord_nombre")%>' />
    </td>
    <td class="actions">
    <asp:LinkButton ID="linkEditar" runat="server" CssClass="btn btn-info btn-small pull-right"
    title="Editar elemento" CommandName="cmdEditar"><i class="icon-edit icon-white"></i> Editar</asp:LinkButton>
    </td>
    <td class="actions">
    <asp:LinkButton ID="linkBorrar" runat="server" CssClass="btn btn-danger btn-small pull-right"
    title="Borrar elemento" CommandName="cmdBorrar"><i class="icon-trash icon-white"></i> Borrar</asp:LinkButton>
    </td>
    </tr>
    </ItemTemplate>
    </asp:ListView>


    $(document).ready(function () {
    $('#grid').dataTable({
    "scrollY": "200px",
    "scrollCollapse": true,
    "paging": false
    });
    });

This discussion has been closed.