Hello,
thanks for your answer This will unfortunately not work. I think I have
explained my App not well enough.
I have two "pages" Result.html and Grid.html, which I have both connected
to controller ResultController.js.
On Result.html the GridData will be determined dynamically. This Data I
want then to Show on the page Grid.html. This is the reason, that this is
another html-page and that it use the same controller ResultController.js.
Normally I want, if the GridData on page Result.html are ready calculated,
that then the automatically the page Grid.html should be loaded with the
calculated data. Via an observer thread in ResultController.js know via a
boolean flag, lets say GridDataAvailabe, on page Result.html, when the
data for the grid are ready calculated.
For simplification my first step was to check, that I can also get the
calculated GridData on page DataGrid.html via button-click. This works. But
the automatical procedure not.
Normally I though, that in method calculate the lines:
$("#gridContainer").dxDataGrid({
dataSource: GridResultData,
columns: GridColumnMetaData});
initialize the Grid, but when changing to page DataGrid.html no data was
bound to the Grid. So I find the work around with the buttons there, i.e. I
recreased again for the stored GridData in ResultController.js and bound it
there again to the Grid.
Is it perhaps a problem, that two html-pages use the same controller?
So I think it is clear that your proposed solution does not fit to this
issue exactly.
Here some main code parts for better understanding:
DataGrid.html.
-----------------------
<div class="scrollable">
<div class="mainWrapper">
<div class="ui-helper-clearfix" ng-controller="ResultController">
<button ng-click="getGridViewData()"
ng-class="{'btn-default': true, 'btn-success':
false, 'btn-danger': false }"
ng-disabled="!file.writeable"
class="btn btn-sm spacer-left"
type="button"
translate="shared.generateGridData"></button>
Comment: This button + call to getGridViewData I want automatically do
by entering page DataGrid.html.
<div id="gridContainer"></div>
<div style="margin:5px;text-align:center">
</div>
</div>
</div>
</div>
Result.html.
----------------
<div class="scrollable">
<div class="mainWrapper">
<div class="ui-helper-clearfix" ng-controller="ResultController">
Comment: On this page I call a funtion calculate to initialize the
grid.
</div>
</div>
</div>
ResultController.js
------------------------
angular.module('bison.controllers').controller('ResultController',
function($rootScope, $scope, BisonApi) {
$scope.dataGridResult = true;
$scope.bInitGrid = false;
$scope.bDeployGrid = false;
var GridResultData = null;
var GridColumnMetaData = null;
$scope.calculate = function(version) {
$scope.bInitCalculation = false;
$scope.dataGridResult = true;
$scope.bInitGrid = false;
BisonApi.getGridResultData($scope.file.id, function(data) {
$scope.dataGridResult = data.bStatus;
$scope.bInitGrid = true;
GridResultData = data.objResultData;
GridColumnMetaData = data.objMetaColResultData;
$("#gridContainer").dxDataGrid({
dataSource: GridResultData,
columns: GridColumnMetaData});
});
}
/** get the data for the GridView */
$scope.getGridViewData = function(version) {
$scope.bDeployGrid = true;
// Reset messages to null;
BisonApi.getGridResultData($scope.file.id, function(data) {
GridResultData = data.objResultData;
GridColumnMetaData = data.objMetaColResultData;
$("#gridContainer").dxDataGrid({
dataSource: GridResultData,
columns: GridColumnMetaData});
});
}
});
Regards Stefan
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.