Unable to discover which Editor Child Row is clicked/selected
Unable to discover which Editor Child Row is clicked/selected
Hi All,
I have a (hopefully) quick question for you. I've used the custom display controller and modal tutorials to assemble a page that displays basic row data, that is then expanded to show more data as an Editor. If I click on an icon that is displayed in one of the editor child rows, a modal pops up and displays another table.
My issue is that I want to dynamically update the modal's table data by updating the ajax url using the ajax.url() API. In order for me to update the URL I need to know exactly what row was actually clicked on within the child row specifically. I'm able to dump the parent row contents to the console but seem to have no visibility into the specific child row clicked on.
So, in my example, if I expand the first (parent) row, then click on the icon that launches the modal in the first child row, I'd like to be able to capture the row that was actually selected, so I can adjust the ajax URL accordingly. So for example if item 1 is clicked on, then I can adjust the URL to reflect that code 1 is selected, etc, etc.
Allan - I've sent you the URL that contains the code I'm working with separately.
Can you please help me out with this? I've tried looking into cell/row indexes, onclick events, row ids ... nothing seems to work for me in this case (but work fine for the parent data).
Thanks all!
Salim
Answers
Hi Salim,
Could you clarify what you mean by "row" here. Do you mean you need to know the parent row information, for example the
Account ID
? In which case useval()
to get the values from the rest of the row.Or do you mean you need to know which field was clicked in the form (i.e. which icon). If this, then that is something that your field's plug-in code would need to handle (presumably wherever you put the event listener you could use a closure to store the field reference and thus get the value).
Regards,
Allan
Hi Allan,
I'm able to pull the parent fields (such as Account ID). It's the additional fields that only show up after I've expanded the row (the child fields), that I can't seem to access. You are correct, I would need to know which icon was clicked or even simply which row the icon belongs too would be enough.
Do you have an example of the plug-in code that I could adapt to my situation?
Thanks Allan!
Salim
I'm afraid I don't have an example of that, however, in the
create
function for your plug-in you presumably have something adding an event to handle the click on the icon. That would be where you need to access the host data.this
in thecreate
function is the Editor instance, so you could usevar that = this;
and then in your event handlerthat.val()
to get the current values of the Editor instance.Allan