Home > Mobile >  How to include an image in DataTable JQuery with MVC?
How to include an image in DataTable JQuery with MVC?

Time:01-20

I´d like to know, How can I include correctly an Image in a DataTable JQuery Plugin on my proyect MVC?

I´ve done de following but I get an alert error

enter image description here

This Is my code and the method within Controller that I use to get the data

enter image description here

enter image description here

CodePudding user response:

in your code you are showing data of row [1] that has a valid url. The error refer to row 0 (see your image, it says error in row 0, col 4). The url in record 0 has to be consistent. here is the clause from datatable site:

  • DataTables has requested data for a given row, of the {parameter} provided and there is no data there, or it is null or undefined (DataTables doesn't know, by default how to display these parameters see if your data does contain these values).

a possible solution is to set datatable option to show dedfult value for null:

    {
      "data": "UrlImagen", // can be null or undefined
      "defaultContent": "<i>No Image</i>"
    }
  •  Tags:  
  • Related