Where am I?

Where am I?

hdissinghdissing Posts: 4Questions: 2Answers: 0

Trying to figure out some client-side validation, playing with the 'Client-side validation' example here http://editor.datatables.net/examples/api/clientValidation.html using

editor.on( 'preSubmit', function ( e, o, action )

I have no problem getting a field (and its value) using

editor.field( 'first_name' )

as shown in the example.
But for my project I would need to know where I am in the table (what cell I am editing, using inline editing), the cells name and its value, and how to use that to get the name and value of the neighbour cell (left or right).

My (planned) project is a workschedule. For each person there is a start and an end time for each day (two columns for each day). So if I input a time in 'tuesday_endtimecell' I need to check that it is later than the cell to the left ('tuesday_starttimecell'). And if I input time in 'monday_starttimecell' it need to be prior to the cell to right ('monday_endtimecell').
My problem is:
When using inline-editing and KeyTable (excel-like navigation) how do I access the name and value of the cell being edited, and how do I access the name and value of the next/prior cell?
I can navigate to ex. 'monday_starttimecell', input a new time and when pressing right arrow on keyboard, it triggers the 'presubmit'-event.
But being in the 'presubmit'-function I can't figure out how to get the relevant information on my position in the table.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    Answer ✓

    The modifier() method is probably what you want here. It will give you the value that was used to start the editing - e.g. if you pass a row node into edit() (first parameter) it will give you that row node. If you pass a cell node into inline() it will give you that cell, etc.

    Allan

  • hdissinghdissing Posts: 4Questions: 2Answers: 0

    Thanks - at least it lead me in yhe right direction.

This discussion has been closed.