Why data.variable not displaying data in widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2024 11:37 PM
Hi Community,
I have two widgets, in which first widget contains text box & search button. When user clicks on Search button, the another widget displays table.
But data is not displaying on table.It seems some issue with - data.gisid & data.location.
However, logs are displaying correctly.
Widget 1 html code:-
<span class="col-md-7"><input id="search_term" name="search_term" type="search" placeholder="Enter Name,GIS ID or DUNS" class="form-control input-md"></span>
<div class="each-pill" ng-class="{'active':c.selectedPill == 'entitytable'}" ng-click="selectPill('entitytable')">
<a type="button" ng-click="c.searchEntityREST()" class="btn btn-primary">${Search Entity}</a>
</div>
Widget 2:-
Html code:-
<table class="table table-striped">
<thead>
<tr>
<th>GIS Entity ID</th>
<th>Entity Name</th>
<th>Entity Location</th>
<th>Entity Type</th>
</tr>
</thead>
<tbody>
<tr ng-if="data.gisid!='">
<td>{{data.gisid}}</td>
<td>{{data.location}}</td>
</tr>
</tbody>
</table>
Server Script:-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 05:38 AM
Just to check, I see you have some log lines in your server script. I assume these are printing the data you expect?
In which case it could well be the call back not updating properly. I would try this.
Server Script
data.gisid = arr[0].toString();
data.location = arr[1].toString();
Client Script
/* widget controller */
var c = this;
$scope.showWidget = "";
$scope.
$scope.$on('showHideWidget', function(event, d, obj) {
$timeout(function() {
c.server.get({
action: "callSearchEntity",
search_term: obj.search_term,
}).then(function(response) {
$scope.gsid = response.gsid;
$scope.location = response.location;
});
alert(obj.search_term);
$scope.showWidget = d;
});
});
HTML
<td>{{.gisid}}</td>
<td>{{location}}</td
This adds a callback function to the client call and populates some client side variables. In turn these variables are used in the script.
The above is untested - I believe the syntax is correct on the callback.
