8
ich Datatable will eine GeoJSON-Datei übergeben, um dynamisch erstellt Datentabelle mit Hilfe von Javascript, ich bin nicht in der Lage Spaltennamen in der Datei zu identifizieren .. ich diese ..Wie GeoJSON Array Pass dyanamically mit Hilfe von Javascript
versucht habeMy Code ist wie diese,
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>fC.type</th>
<th>f.type</th>
<th>f.prop</th>
<th>f.geom.type</th>
<th>geometry.coordinates.0</th>
<th>geometry.coordinates.1</th>
</tr>
</thead>
</table>
</body>
$(document).ready(function() {
$('#example').dataTable({
"ajax":"data/json_file.json",
"processing":true,
"columns": [
{ "mData": "type" },
{ "mData": "features.type" },
{ "mData": "features.properties" },
{ "mData": "geometry.type" },
{ "mData": "geometry.coordinates.0" },
{ "mData": "geometry.coordinates.1" }
]
});
});
und GeoJSON Datei ist
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
40.078125,
57.136239319177434
],
[
91.7578125,
58.99531118795094
]
]
}
}
]
}
My output is as shown in image
Ich habe versucht ,, Ich habe einen Fehler „Nicht abgefangene Typeerror: kann Eigenschaft‚Länge‘undefinierter lesen“. – Priyanka