Make DataTable Cells Permanently Editable

Make DataTable Cells Permanently Editable

pjb0515pjb0515 Posts: 7Questions: 0Answers: 0
edited October 2011 in General
I am using DataTable to create a table that requires some cells to be editable. The JEditable plugin doesn't seem to fit my needs as I want the cells to look editable at all times, not just after being clicked. I tried to accomplish this goal by just using html text boxes, but I cannot access some of these text boxes if there are multiple pages because they are no longer loaded. I then tried to fix this problem by using fnGetData() and regex to get what the value= for the string held in the list of strings returned by fnGetData(), but it seems like that string does not get updated when the text box value is updated.

Sorry if my write up is a little confusing, any help would be greatly appreciated.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited October 2011
    probably simplest way would be to use fnRender (or fnRowCallback) to convert your values to input boxes, attach some handler on "change", or a button the user clicks, to update database with ajax calls.

    obviously this doesn't answer the question of getting data not currently on the page. I'm a little curious why you need off-page data, and also which initialization method you're using (html, array, ajax, server side).
  • pjb0515pjb0515 Posts: 7Questions: 0Answers: 0
    Thanks for the reply fbas.

    I need all of the paginated pages because my application requires summing all of the values in the editable fields and showing what the current total is at all times. I am also using JSP to loop through my models and storing them into a normal HTML table as my initial data.

    I will look into fnRender and fnRowCallback to see if they lead me in the right direction.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    You can have your JSP summarize the data even if only a subset is passed to DataTables. This doesn't help you much, though, if/when you filter the data and want the summarized data to reflect that.

    If you are using bServerSide data, you can include summary info in the JSON response and thus get a dynamic summary, including filtering.
  • pjb0515pjb0515 Posts: 7Questions: 0Answers: 0
    edited October 2011
    I just got it working, good idea with the fnRowCallback. I am able to always store my data as a float (no longer an html element) and when the table goes to load the data I use fnRowCallback to format the current value of the row and column and create a html text box with an onchange function attached.

    Thanks for the advice fbas.
This discussion has been closed.