Accessing a function from another column

Accessing a function from another column

jrowan20jrowan20 Posts: 13Questions: 7Answers: 0

Hi All,

Is it possible to define a function in one column, and access that same function in another column?

So the function is a fairly lengthy calculation of certain values, but I want to use the function in multiple columns without having to rewrite the whole things over and over

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Create the function outside of Datatables then call it in columns.render or where ever you want to use it.

    Kevin

  • jrowan20jrowan20 Posts: 13Questions: 7Answers: 0

    Hi Kevin,

    Thanks for the response

    Is there a way of accessing table data outside of the ajax call, within a function?

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Is there a way of accessing table data outside of the ajax call, within a function?

    In general the answer is yes. Not sure what you are trying to do. I'm guessing you are using this function in something like columns.render. In this case you would pass the column data as a parameter into the function.

    If this doesn't help then please describe what you are trying to do so we can give a more specific answer.

    Kevin

Sign In or Register to comment.