Filtering the Menu list for the Angular JS, Graphs
-
With this menu list provided by Mango. This grabs every point in the Mango DB. Is there a way I can filter this list to specific points, so I can make these lists for specific buildings or areas.
<md-input-container class="md-block no-errors-spacer">
<label>Choose a point</label>
<ma-point-list ng-model="myPoint"></ma-point-list>
</md-input-container> -
Yes, please see the "Point list" example under "Basics". I'd recommend setting the "Device name" for each point to your building name, or implementing a specific point naming strategy that incorporates the building/area name.
-
<div layout="column">
<md-input-container class="md-block no-errors-spacer">
<label>Choose a point</label>
<ma-point-list ng-model="myPoint" query="deviceName(032 GAS East)"></ma-point-list>
</md-input-container><p>You have chosen point "{{myPoint.name}}". It is {{myPoint.enabled ? 'enabled' : 'disabled'}} and belongs to device {{myPoint.deviceName}}</p>
-
I'm going to take it that you are asking why that markup isn't working?
Pay close attention to the syntax of the query attribute, it should be
query="{deviceName:'032 GAS East'}"
-
Thanks Jared. Worked like a charm
I'm loving this btw!!!
-
Jared,
what if I wanted to make a variable reference to the query. That way, I could add in the top of my document a variable, that would then fill in the deviceName
-
It would be pretty similar to the example only set to query on deviceName:
<md-input-container> <label>Set Variable for Device Name</label> <input ng-model="deviceNameVariable" ng-model-options="{debounce:500}"> </md-input-container> <md-input-container> <label>Filtered point list</label> <ma-point-list limit="200" ng-model="myPoint2" query="{deviceName:deviceNameVariable}"></ma-point-list> </md-input-container>
In angular you can use ng-model or ng-init to declare scope variables without the var keyword.
With ng-init (you can move ng-init to a div at the top of the document)
<md-input-container ng-init="deviceNameVariable='meta'"> <label>Filtered point list</label> <ma-point-list limit="200" ng-model="myPoint2" query="{deviceName:deviceNameVariable}"></ma-point-list> </md-input-container>
-
Thanks Jared. What If i wanted to filter y the datasource name instead of deviceName?
would it be {datasource: "UofU Stadium East'}
-
@atkins.chrisw said in Filtering the Menu list for the Angular JS, Graphs:
Thanks Jared. What If i wanted to filter y the datasource name instead of deviceName?
would it be {datasource: "UofU Stadium East'}
It will be
{dataSourceName: 'UofU Stadium East'}
-
Perfect. Worked great
-
Also... What if I wanted to filter it between two different datasources with specific deviceNames?
,