Creating A Dom For Textarea From Sql Queries Table Result
I got the DOM object that creates table and I want a new function /DOM that create a Textarea from table result with a column name AsText(Geometry) (i.e. fieldName[i] = 'AsText(Geo
Solution 1:
It is hard to tell what part of this you are having trouble with. I'm supposing that you are having trouble getting your displayAsTextGeometryVCF()
function to work. Here is a rewritten version. Please try it:
functiondisplayAsTextGeometryVCF(bcoResults) {
var aResult = bcoResults[0];
if (aResult.errorMessage != 'not an error') {
handleError('queryError', [aResult.errorMessage]);
return;
}
var fieldNames = aResult.fieldNames,
records = aResult.data,
container = document.getElementById('queryResults');
container.innerHTML = '';
var theField = 0;
for (var i = 0, ii = fieldNames.length; i < ii; i++) {
if (fieldNames[i] == 'AsText(Geometry)') {
theField = i;
break;
}
}
for (var i = 0, ii = records.length; i < ii; i++) {
var t = document.createElement('textarea');
t.innerText = records[i][theField];
container.appendChild(t);
}
}
For this data:
displayAsTextGeometryVCF([{
errorMessage: 'not an error',
fieldNames: ['dummy', 'AsText(Geometry)'],
data: [
['one','yes'],
['no','yes']
]
}]);
The output is:
<div id="queryResults"><textarea>yes</textarea><textarea>yes</textarea></div>
Is that what you wanted?
Post a Comment for "Creating A Dom For Textarea From Sql Queries Table Result"