Ich habe mehrere Datensätze in der Tabelle .. Szenario, wenn ich auf Zeile dann Diagramm klicken ist Anzeige nach ID jetzt möchte ich angeben, welche Besitzer diese Daten haben, so dass ich versuche, den Namen des Besitzers anzuzeigen. .Wählen Sie Zellenwert aus Tabelle
ich habe Daten in einer Tabelle:
ID Owner RegNo
26626 John B82
26634 David BE49
26642 Roh A5
26640 Julie B5
ich das versucht:
<script type="text/javascript">
$(function() {
$('#tabledata').on('click', 'tr', function() {
var row = $(this);
var Id = row.find('td')[0].firstChild.data;
var cell = row.find('td')[1].firstChild.data;
var obj = {};
var cellvalue = {};
obj.ID = Id;
cellvalue.cell = cell;
GetData(obj);
return false;
});
});
function GetData(obj) {
$.ajax({
type: "POST",
url: "WebForm1.aspx/GetVo",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (result) {
if (result !== null && result.length == 0) {
$("#cont").hide();
return;
}
strArray = result.d;
var myarray = eval(strArray);
$("#cont").show();
$('#cont').highcharts({
chart: {
borderColor: 'Grey',
borderWidth: 2,
type: 'pie',
options3d: {
enabled: true,
alpha: 45
}
},
title: {
text: JSON.stringify(cellvalue)
},
position: {
align: 'right',
verticalAlign: 'bottom',
x: 10,
y: -10
},
subtitle: {
text: 'Chart'
//text: 'Total: ' + myarray.length
},
plotOptions: {
pie: {
innerSize: 100,
depth: 45,
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.y}',
},
showInLegend: true
}
},
series: [{
name: 'Delivered amount',
data: myarray
}]
});
//end
},
error: function (error) {
alert(error);
}
});
}
// });
</script>
wenn ich f12 überprüfen dies zeigt den Fehler
WebForm1.aspx:109 Uncaught ReferenceError: cellvalue is not defined
Ihr Cellvalue ist in ihrem Umfang nicht für Zeile: 'Text: JSON.stringify (Cellvalue)' –
können Sie passieren Cellvalue zu 'GetData (obj) ; '' 'GetData (obj, cellvalue);'. –
aber wenn ich diese Funktion GetData (obj, cellvalue) aufrufen, dann muss ich dort auch die Funktion GetData (obj) aufrufen .. ich will das nicht aufrufen .. ich will nur wenn wir in Zeile auswählen, dann will ich Besitzer bekommen Zellenwert im Label – user6628729