Tools ( button, select etc. ) not showing up MVC 5

Tools ( button, select etc. ) not showing up MVC 5

aqwzsx33aqwzsx33 Posts: 1Questions: 1Answers: 0

Hi

I'm trying to use Datatable for my web application. I encountered two issues.

I'm using Datatable following the really basic zero configuration tutorial. The weird thing is that I've been able to make it work nicely but it was only working on my first tr. The others tr were there but were not considered as "entries". So I thought let's try to implement it differently it might be because of hiw I built my cshtml file, but it's only getting worst ( I came to the point where the tools are not showing up anymore ).

My code ( into a csthml file / using MVC5 ) is looking like that :

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css"/>
 
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>



TABLE

- thead

--TR
---th
---th
...
---th
--/TR

-/thead

- tfoot

--TR
---th
---th
...
---th
--/TR

-/tfoot

-TBODY

*foreach X in x...some C# doing thing

**foreach Z in z... some C# doing thing 

--TR

---td X.Name
---td Y.Name
---td Y.Time

***foreach W in w
IF...
---td status1
else if
--- td status2
....

/IF

//foreach W in w
--/TR
///foreach Z in z
////foreach X in x 
-/TBODY
/TABLE



<script type="text/javascript">
    $(document).ready(function () {
        $('#example').DataTable();
    });
</script>

I hope it's clear enough. The table is displaying correctly so I don't really know what is going wrong.

Cheers.

Answers

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    How did you set the id of the table element to "example" in your file? I'm only seeing it in the javaScript.

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    The weird thing is that I've been able to make it work nicely but it was only working on my first tr. The others tr were there but were not considered as "entries"

    This would normally happen if each row has its own tbody element. There should be only one tbody in your DataTable (DataTables only supports one).

    Allan

This discussion has been closed.