DataTable - Cell Editing

DataTable - Cell Editing

antonio77antonio77 Posts: 17Questions: 0Answers: 0
edited January 2010 in General
Hi folk, I appreciate this great plug-in.

In the following example:
http://datatables.net/examples/api/editable.html
when you try to edit a cell a appears.

It would be great if, according to the cell columns selected, appeared a different
for example: .

An example to this URL:
http://developer.yahoo.com/yui/examples/datatable/dt_cellediting.html
and try to click on "state" cell.

A little hint would be nice!

thanks,

Antonio

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Antonio,

    It's quite possible to do that, it's just that DataTables doesn't provide an internal way to do it. As you can see from the example jEditable is used to add the text input, and it is quite possible to use that plug-in to get different input controls as well: http://www.appelsiini.net/projects/jeditable . There are several other 'edit-in-place' plug-ins for jQuery as well which would also work just as well.

    Regards,
    Allan
  • antonio77antonio77 Posts: 17Questions: 0Answers: 0
    Hi Alan,

    thank for the suggestion,
    It is enough for me.

    Antonio
  • antonio77antonio77 Posts: 17Questions: 0Answers: 0
    Hi Allan,

    seeing better to the jquery.jeditable.js,
    seems DataTables provide an internal way to do it.
    $.fn.editable can accept as "parameter type": text, option, textarea ecc...
    or maybe I missed something?

    Antonio
  • KorkiKorki Posts: 1Questions: 0Answers: 0
    Hi everbody,

    Using datatables in combination with jeditable works great for me. I just have one question:

    jeditable is posting value and id to a savescript. Value is filled with the new entered value but not the id. This seems to be correct because attribut id is missing in tag. I know how to modify the class or name atribute:
    [code]
    "aoData" : [
    { "sClass": "addon" },
    { "sClass": "category" }
    ],
    [/code]

    Do i have a chance to set the id attribute?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    @Antonio: I'm not sure what your question is? You can use different input types with jEditable as shown here: http://www.appelsiini.net/projects/jeditable/default.html

    @Korki: DataTables doesn't provide a method to set an ID (since you would need to do it for every cell, and then you might as well do it with standard DOM methods). You can add it just be looping over the created rows/cells if you want, or you can use fnGetPosition (and possibly other functions) to get the position and other information. See this example: http://datatables.net/examples/api/editable.html

    Allan
This discussion has been closed.