[SOLVED] How do I specify a column of selected row as value for new record
[SOLVED] How do I specify a column of selected row as value for new record
mkleinosky
Posts: 46Questions: 6Answers: 5
I want to restrict user from using "New" button until they have select a row - the table has records joined from 2 tables.
I want user to select a row and then be able to click "New"
Then I want to pre-fill the column "Eid" with the same value of "Eid" on the selected row...
editor
.create( true) // can be false if I can add record and refresh table
.set( 'Eid', ****needs to be value from selected row of tAttendance.Eid** ' )
.submit();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I tried this to add a "New" button when row is selected but button does not appear
http://caritasme.com/dtedit_Attendance1.php?Eid=1
What I would suggest is that you create a new TableTools button that extends the
select_single
button type (i.e.sExtends: 'select_single'
). Then use a customfnClick
method for the button to check if a row has been selected or not (this.fnGetSelected().length===1
) and if so callcreate()
.The
editor_create
button probably isn't going to help you here, I would suggest ignoring it and creating your own (like how you have for the collection).Allan
Wow, thanks, will get started trying that ...
Thank you!
Code I get to next works just as you said! (in case anyone else is at novice level like me and can use this ..)
solved... see above