define primary key
define primary key
I am almost sure in the past I had to define the primary key for a Button. I am getting an error on another project and I believe that is what is going on again here. But, I can't find the syntax that I had used before (i don't remember what previous project it was in
Doesn't it go somewhere in here:
buttons: {
buttons: [
{ extend: 'create', editor: EquipmentOnLoan_DeptFundOrgEditor, text: 'Assign Fund/Org' },
{ extend: 'create', editor: EquipmentOnLoan_LoanRateLinkEditorStandalone, text: 'Assign Rate' }
]
}
I hope my question makes sense.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What is the error you are getting?
You probably just want this:
Similar to this example.
Kevin
oh, that extra 'buttons' is from when I was doing extra stuff but I ended up not doing that for this set of buttons. However, that is not what is causing the error. The first create button, which is tied to a different editor, works fine. When I click on the second I get:
Uncaught TypeError: Cannot read property 'one' of null
However, I have two other dataTables that uses the same editor and they work fine (well, one is almost fine and that is a question for another post).
Can you post a link to your page or a test case showing the issue?
Its not obvious what the problem is with just the buttons config. The problem is somewhere else on your page.
Kevin
Sorry, I can't post a link as this is on an intranet.
However, I added the following:
When I click the first button (the one that works) I see data under the 'editor' property. For the button that does not work, I see:
editor: null
here is the editor I am trying to call:
here is the complete "alerts" dataTable which has the button that is not working:
In the alerts datatable the primary key is LOANRESOURCEID, while in the editor, the primary key is "EquipmentOnLoan_LoanRateLink.LoanResourceID".
I remember once having to add the primary key to the button because they were different, but I can't find that code in my projects or in any dataTables documentation (but, perhaps this is a different issue altogether??)
Guessing the
null
is coming from this, on line 17 of the Editor config:Maybe it should be the ID of your HTML table, like this:
According to the
table
docs you could use the Datatable API as it looks like you are trying to do. The problem is that you are defining the variableEquipmentOnLoan_LoanRateLinkTableStandalone
after the Editor initialization.Kevin
oh my goodness... that was so stupid of me
The Alerts dataTable was before the standalone as well, so the editor was not even defined yet there!!
Thank you so much.