该函数
isSubscribed应用于元素,
$('#gridtable')但已订阅$(document)。我已经测试了最后一个元素,但对我没有用。但是尝试了第一个元素,它起作用了。
脚本:
<head> <link href="<s:url value="/css/template_styles.css"/>" type="text/css" rel="stylesheet"> <sj:head /> <title>jQuery Grid</title> <script type="text/javascript"> $(document).ready(function(){ console.log("Before subscribe"); $("#gridtable").subscribe("beforeTopic", function(topic, data) { console.log('Topic: '+data, topic); if ( $("#gridtable").isSubscribed("beforeTopic") ){ console.log('Subscribed: '+data, topic); return; } //go on with function console.log('Not subscribed: '+data, topic); }); console.log("After subscribe"); }); </script></head>对于网格:
<sjg:grid id="gridtable" onBeforeTopics="beforeTopic" >



