Accessing the row_id in the Edit dialogue

Accessing the row_id in the Edit dialogue

bucketfanbucketfan Posts: 6Questions: 0Answers: 0
edited November 2013 in Editor
Is there a place to look up the DT_RowID once in the Edit dialogue, through a data() call or other ? I don't seem to be able to find it digging for data, but seems I may have missed it ?

Sorry for the basic question. Banging head on this one.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Perfectly good question! fnGetData is the method to use currently, to get the data (1.10's new API will add a `row().data()` method, but fnGetData will still be present!).

    fnGetData would take a single parameter - the row node ( `tr` element) that is being edited and give you back the original data source object so you could do: `table.fnGetData( row ).DT_RowId` .

    Where are you trying to get this information? Is it when the edit is first shown (in which case onCreateEdit event might be useful?).

    Regards,
    Allan
  • bucketfanbucketfan Posts: 6Questions: 0Answers: 0
    Hi Allan,

    I actually want to access it in the onOpen() call back, but it isn't passed any data. What I ended up doing is set up a virtual accessor like "readonly_rowID" as a hidden type and query that in the onOpen callback - but this seems like perhaps is the wrong way. However, the workaround is working :)

    I don't actually see an onCreateEdit method anywhere in the docs or really on google??
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    > onCreateEdit

    Oops sorry - I mixed up the event names. I meant to say onInitEdit - https://editor.datatables.net/api/#onInitEdit . The 1.2.4 update to Editor passes in the row being edited and the data for the row to this event for easier access.

    Allan
  • bucketfanbucketfan Posts: 6Questions: 0Answers: 0
    Ah-ha - of course you have addressed this in the newer version =)

    Cheers!
This discussion has been closed.