I would like to drag a row from a JQGrid to a text input field and add a column's text from the dropped row to the end of the text in the input.
Obviously this is a long way from the answer, but dragging a row from a grid with this set up on it (where #inputTextField
is a 'droppable' text field) results in the JavaScript error this.p is undefined
:
$("#searchResultsGrid").jqGrid('gridDnD',
{
connectWith: '#inputTextField"
}
);
This is because the destination is obviously not a JQGrid and does not have this.p
defined. I've tried a few different things...maybe there is a way I can 'trick' the drop event into working? Thank you so much for any help :)
I figured it out!! First, make the grid rows draggable (this function should be called in your gridComplete grid event handler):
Then, create droppable elements:
Create a helper method to append text to text field (appending a trailing ';'):