Cannot read property 'api' - aurelia

I'm trying to define the columns.
import { GridOptions } from "ag-grid-community";
import "ag-grid-enterprise";
......
private gridOptions:GridOptions;
.....here I fill columdDefs
this.gridOptions.api.setColumnDefs(columnDefs);
but when I execute I get this error.
Unhandled rejection TypeError: Cannot read property 'api' of undefined at HoursDataTable.defineColumns
Any idea please?
Regards

Solved adding this
this.gridOptions = <GridOptions>{};
Thanks

Related

Share image from `expo assets` using expo-sharing produces mysterious error

I am using latest expo-47 with dev-client i have taken care of creating custom dev-client that includes the libraries that i am using on the given code.
So i will explain my case ( i am targeting android ) :
Inside the local expo assets i have 30 images
I want to allow the user to share the images using expo-sharing but i am getting error [ see end of post ]
Below is an example of many codes i have tried it just doesn't work :
import * as Sharing from 'expo-sharing'
async function shareImage(imageURI) {
try {
await Sharing.shareAsync(require('../../../assets/images/motivational/36.jpg'))
} catch (error) {
console.log(error)
}
}
The error is the below :
[Error: Argument of an incompatible class: class java.lang.Double cannot be passed as an argument to parameter expecting class java.lang.String.]
What is this supposed to mean ?
I HAVE of course verified that the image exists on the given path
Remove the require statement from .shareAsync.
Write it like this :
await Sharing.shareAsync('../../../assets/images/motivational/36.jpg')
-OR-
Define the path before hand and call it as
await Sharing.shareAsync(imageURI).
Let me know if this solves it.

Aurelia property-observation warning when using #children

I'm getting the following warning when using the #children decorator:
vendor-bundle.js:14294 WARN [property-observation] Cannot observe property 'columns' of object
My custom element code is:
#children('data-grid-column') columns = [];
I'm trying to bind it to this view-model so that I can get an array of objects with the column data:
import {bindable, noView} from 'aurelia-templating';
#noView
export class DataGridColumn {
#bindable name;
#bindable display;
#bindable align;
}
It works perfectly, but the error seems to indicate something is wrong. I have no need for property-observation here, but would like to know why I'm getting the error.
<data-grid data.bind="records">
<data-grid-column name="acc_code" display="Code"></data-grid-column>
<data-grid-column name="acc_name_orig" display="Account"></data-grid-column>
</data-grid>
It seems to be a known issue that has been already fixed. I think this warning will be gone in the next aurelia-templating release. See https://github.com/aurelia/templating/issues/520
Right now, it doesn't happen if you use #children at the class level.
#children({ name: "columns", selector: "column" })
export class DataGridColumn {
//...
}

How to fix this error:Uncaught (in promise) TypeError: this.state.arrdata.map is not a function

How to fix this error:
Uncaught (in promise) TypeError: this.state.arrdata.map is not a function
I am learning React and I hope you can help me. Thanks!
OpenWeatherMap's API does not return an array, but an object.
Objects do not have a map() function.
I would suggest using lodash.map because it doesn't care if it's undefined, object or array which could save a lot of trouble.
import _ from 'lodash';
var listItems = _.map(this.state.arrData, (function(item){
... bla bla bla
})

Uncaught TypeError: $translate is not a function

This is my code:
$translate('singlePointHistory.B').then(function(paragraph{overcrowdedDetail.personNum = paragraph;});
It gives the following error::
Uncaught TypeError: $translate is not a function
Why?
Looks like you are missing a bracket after paragraph . So it would be
function(paragraph) {
vercrowdedDetail.personNum = paragraph;
});
Also, I would try using $translate.instant(key);
Make sure you have injected $translate to your controller.

Play 2.1 - WS API - Missing Type Param Compile Error - WS.url(...).get().map { r => ... }

The error missing parameter type for response is given when I try to compile this code which comes (almost) directly from the Play 2.1 Docs
def feedTitle(feedUrl: String) = Action {
Async {
WS.url(feedUrl).get().map { response =>
Ok("test")
}
}
}
So then I give it a type like this, {response: WS.Response => ...} but then I get this error:
type mismatch;
found : play.libs.WS.Response => play.api.mvc.SimpleResult[String]
required: play.libs.F.Function[play.libs.WS.Response,?]
I think your imports are wrong. It should be play.api.libs.ws.WS instead of play.libs.WS.Response.
See http://www.playframework.com/documentation/api/2.1.0/scala/index.html#play.api.libs.ws.Response
My problem was that I imported play.libs.WS and not play.api.libs.ws.WS (notice the api package). I had to also import scala.concurrent.ExecutionContext.Implicits.global but the error message told me to do so, so that was simple.