当用户将焦点放在一个名为引用号的字段上时,我试图显示一条消息,该字段位于我的光滑网格上的第10列和第1行。它也恰好是网格中的最后一个字段。模态应显示一条消息,通知用户他们将要输入的参考号可用于查找其帐户活动。以下是光滑的网格布局。
<script>
var columns = [
{ id: "Country", name: "Country", field: "Country", minWidth: 120, editor: Slick.Editors.Auto},
{ id: "Manufacturer", name: "Manufacturer", field: "Manufacturer", minWidth: 120, editor: Slick.Editors.Text },
{ id: "ReferenceNumber", name: "Reference Number", field: "ReferenceNumber", minWidth: 120, editor: Slick.Editors.Text },
];
以下是单击单元格以显示模态时要使用的脚本。
<script>
function cellClicked(e) {
var grid = Columns;
var cell = grid.getCellFromEvent(e);
var item = grid.getDataItem(cell.row); // all the data in the row
if (cell.cell == grid.getColumnIndex('ReferenceNumber')) {
$('#ReferenceModal').modal('show');
console.log("ReferenceNumber");
}
}
如果用户输入了单元格(第10列,第1行),如何更改参考编号字段上的编辑器以显示模态?
由于
答案 0 :(得分:0)
尝试使用grid.onClick.subscribe
例如
grid.onClick.subscribe(function(e, args) {
var item = grid.getDataItem(args.row);
if (args.cell == grid.getColumnIndex('ReferenceNumber')) {
$('#ReferenceModal').modal('show');
console.log("ReferenceNumber");
}
//.. do more stuff here to flag that the modal was once diplayed. I would imagine modify the item prop e.g. item.displayed=true... then invalidate the items on grid again.
});