cannot read property mdata of undefined – Uncaught TypeError : Cannot read property ‘mData’ of undefined

cannot read property mdata of undefined – Having thead and tbody with the same numbers of th and td solved your problem.

cannot read property mdata of undefined

Error : Datatables: Cannot read property ‘mData’ of undefined OR cannot read property mdata of undefined

The following will throw error (no thead and tbody tags)

Simple Example for Datatables

<table id="product-table">
    <tr>
        <th>header-1</th>
        <th>header-2</th>
    </tr>
    <tr>
        <td>description-1</td>
        <td>description-2</td>
    </tr>
</table>

console error “Cannot read property mData of undefined”..?? – The following best example will also throw an error (unequal number of columns)

Also Read This πŸ‘‰   how to pass parameter in onclick function in javascript?

<table id="product-table">
    <thead>
        <tr>
            <th>header-1</th>
            <th>header-2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>description-1</td>
            <td>description-2</td>
            <td>description-3</td>
        </tr>
    </tbody>
</table>

Don’t miss : Javascript Runtime Error Function Is Undefined

I hope you get an idea about cannot read property mdata of undefined.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.