Show Yes/No (or image) if cell has data

Show Yes/No (or image) if cell has data

noslannoslan Posts: 29Questions: 0Answers: 0
edited October 2013 in General
Hi

I have a cell called "notes" or "comments" which I dont want to show in datatables (cos they can contain big amount of data and it messes the table up) So the idea is to create a "virtual" table chich shows "yes" if the comment cell has data inside (then I'm showing this via editor, no problem) Is there a way to do it?

Thanks!

Replies

  • jgouletjgoulet Posts: 26Questions: 2Answers: 1
    There are a few ways to do it. You could add a database call to your DAO that returns a boolean of true or false based on if that database field is null or not, then pass that value to the datatables "comments" field. Or you could put an if test directly in the code that you are using to create the table, which does the same thing.
  • noslannoslan Posts: 29Questions: 0Answers: 0
    thanks, but this line of thinking is what I know, My questions is how to start this...
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Personally I'd use mRender to do it:

    [code]
    mData: "notes",
    mRender: function ( data, type, row ) {
    return data ? "Yes" : "No";
    }
    [/code]

    Allan
  • noslannoslan Posts: 29Questions: 0Answers: 0
    Thanks Allan! It works perfectly! if you can help me with form "details" I'll apreciate it really!

    http://datatables.net/forums/discussion/18057/edit-form-with-html-inline-datepicker-and-buttons-different-status-enabled-disabled#Item_1
This discussion has been closed.