我有两个元素和它们之间的联系。建立连接后,我为此连接设置参数:
private async void WaitForIncomingMessagesAsync()
{
var buffer = new byte[8192];
var stringBuilder = new StringBuilder();
while (IsRunning)
{
using (var responseStream = WebRequest.Create("some url").GetResponse().GetResponseStream())
{
int receivedDataCount;
do
{
receivedDataCount = await responseStream.ReadAsync(buffer, 0, buffer.Length);
if (receivedDataCount != 0)
{
stringBuilder.Append(Encoding.ASCII.GetString(buffer, 0, receivedDataCount));
}
} while (receivedDataCount > 0);
}
var receivedDataJson = stringBuilder.ToString();
Array.Clear(buffer, 0, buffer.Length);
stringBuilder.Clear();
}
}
一切正常。
如何通过点击按钮以编程方式获取参数'isNo'?
jsPlumb.bind("connection", function(e) {
........
jsPlumb.select(e).setParameter('isNo','1');
........
});
<script>
$( "#getparam" ).on("click", function() {
// How to get the connection parameter?
});
</script>
答案 0 :(得分:0)
OP解决方案。
我用这种方式解决了问题:
var getConn = jsPlumb.getConnections();
if(getConn.length > 0){
$.each(getConn, function (e,s) {
var parameters = s.getParameters();
console.log(parameters.isNo);
});
}