我在此行中向网格添加了一个名为快照的按钮:$ crud-> add_action('Snapshot','','Configure / snapshot','ui-icon-signal-diag'); 我还添加了一个名为快照的功能:
public function snapshot($post_array, $primary_key)
{
$user=$this->session->userdata('userid');
return($post_array);
}
我需要进行设置,以便在按下快照按钮时,将运行以下js代码:
// The ID of the extension we want to talk to.
var editorExtensionId = "abcdefghijklmnoabcdefhijklmnoabc";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
function(response) {
if (!response.success)
handleError(url);
});
它来自https://developer.chrome.com/extensions/messaging#external-webpage。按下快照按钮时,如何格式化上面的runtime.sendMessage以运行?