有没有办法使用 gridDnD 插件将行从 JQGrid 拖动到可放置文本字段?
我想将一行从 JQGrid 拖动到文本输入字段,并将列的文本从拖放的行添加到输入中文本的末尾。
显然,这与答案相去甚远,但是从设置了此设置的网格中拖动一行(其中 #inputTextField
是一个“可放置”文本字段)会导致 JavaScript 错误 this.p 未定义:
$("#searchResultsGrid").jqGrid('gridDnD',
{
connectWith: '#inputTextField"
}
);
这是因为目标显然不是 JQGrid,并且没有定义 this.p
。我尝试了一些不同的事情......也许有一种方法可以“欺骗”放置事件以使其工作?非常感谢您的帮助:)
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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了!!首先,使网格行可拖动(应在 gridComplete 网格事件处理程序中调用此函数):
然后,创建可放置元素:
创建一个辅助方法以将文本附加到文本字段(附加尾随“;”):
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 ';'):