Create row inline with an unique form field

Create row inline with an unique form field

N0tChrisN0tChris Posts: 7Questions: 0Answers: 0

I'm looking for a way to inline create a new table row but I just want to set a value for the first cell and complete other fields with my code.
Is it possible to handle it with DataTables Editor?

$(tableId).on('click', 'thead th.row-create', function () {
      editor.inlineCreate(table.cells(this.parentNode, '*').nodes()) // Here, I want to edit only the first cell 
})

Thanks for your answers!

Replies

  • colincolin Posts: 14,185Questions: 1Answers: 2,404

    Thank you for your question about Editor, but our accounts aren't showing that you have a license - it just reports that your trial expired. Is the license registered to another email address? Please can let us know so we can update our records and provide support.

    Thanks,

    Colin

  • N0tChrisN0tChris Posts: 7Questions: 0Answers: 0
    edited January 21

    Hi,
    The license was purchased by my client. With this email address, I suppose : <snip>

  • mc2devmc2dev Posts: 33Questions: 6Answers: 0

    Hi,
    It's N0tChris again but I'm now connected with my client account who purchased the licence.
    Can you give me a support with my problem?

  • colincolin Posts: 14,185Questions: 1Answers: 2,404

    Thanks for that info!

    You could do something like this here - see the "New inline" button. It's based on this example, but once the row has been created it fills in the "Position" field. Does that do the trick?

    Colin

  • mc2devmc2dev Posts: 33Questions: 6Answers: 0

    Thank you for your answer!

    Unfortunately, this example doesn't fill my needs because I find an other way to auto-complete my fields (with preCreate event).

    Now, I just want to don't let the possibility to users to edit other fields than "title", like "start date" field in your example.

    To illustrate my words, here is a screenshot which show my table when I inline create a row :

    On this screenshot, I don't want the user can edit the comment field (the second one) but only the title filed (the first one).

    Thanks again for your precious help!

  • colincolin Posts: 14,185Questions: 1Answers: 2,404

    You can call field().disable() to make it read-only - see my earlier example updated here: http://live.datatables.net/puvoyalo/2/edit

    Colin

  • mc2devmc2dev Posts: 33Questions: 6Answers: 0

    Thanks for your answer Colin!

    It fits perfectly my needs!

Sign In or Register to comment.