search-key.js
690 Bytes
var $ = require('jquery'),
common = require('../../common/common');
$("#searchKeys").val(window.NETSALEDATA.productExtBo.searchKeys);
var g = new common.grid({
el: "#search-key",
hash: false,
columns: [{
display: "ID",
name: "id"
}, {
display: "内容",
name: "content"
}, {
display: "操作",
name: "",
render: function(item) {
return '<a class="btn btn-info add" data-index="' + item.__index + '">添加</a>';
}
}]
});
g.init('/netSale/queryHotSearchTerms');
$(document).on('click', '.add', function() {
var item = g.rows[$(this).data("index")];
var value = $("#searchKeys").val();
if (value) value += ",";
$("#searchKeys").val(value + item.content);
});