Ag Grid Properties do not exist while using TypeScript - ag-grid

I'm trying to use TypeScript and AgGrid and using an example similar to https://www.ag-grid.com/react-data-grid/column-sizing/#resizing-example
The issue is that when using TypeScript I get different values than when I'm trying to use regular JavaScript.The main property I'm trying to get back is api
https://gitpodio-templatetypescr-ze7tjimg9lm.ws-us43.gitpod.io/ - here is a gitpod that I created. If you look at the console.log I get most of the same properties, but I'm not getting the api property to make changes.
*** Edit ***
Actually one thing I just noticed is that if I use
import { AgGridReact } from 'ag-grid-react'; it works properly
but if I use
import { AgGridReact } from '#ag-grid-community/react'; it doesn't work. Why would there be a difference and what am I missing?
*** Edit 2 ***
Why do I need to at least put in one module to get the api? Is there a core module that I can put in, instead of something like the ClientSideRowModelModule to trigger the api?

Related

How to replace deprecated SOBE Code in TYPO3 10.4

I inherited an old TYPO3 Extension using SOBE. As far as I unterstand it's deprecated, but it seems there is no documentation on how to replace it.
The Extension is using Backend Forms and the following line is throwing an error:
if (is_array($GLOBALS['SOBE']->editconf['tt_content']) && reset($GLOBALS['SOBE']->editconf['tt_content']) === 'new') {
The error is:
Cannot access protected property TYPO3\CMS\Backend\Controller\EditDocumentController::$editconf
The Var $GLOBALS['SOBE'] is still there, and there is also editconf, but it's not working.
How can I replace this code or rewrite it?
The SOBE object is part by part removed since years. As there are multiple ways for using it - see https://docs.typo3.org/c/typo3/cms-core/main/en-us/search.html?q=sobe&check_keywords=yes&area=default - you may need to take a closer look what is the exact part of replacing this code.
I would guess you can see more at https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.2/Deprecation-84195-ProtectedMethodsAndPropertiesInEditDocumentController.html?highlight=editconf.

How to avoid errors from onchange methods on lightning-input?

I'm trying to learn the basics of Lightning Web Components and I'm having trouble getting the value of a lighting-input element.
I understand that it's designed for one way data binding instead of two way (a decision that I find questionable), but I can't get an onchange method to work either. I'm running this sample on the Lighting playground:
//app.html
<lightning-input
label="test"
onchange={handleChange}>
</lightning-input>
//app.js
import { LightningElement, track, api } from 'lwc';
export default class App extends LightningElement {
handleChange(event) {
console.log(event)
}
}
And making any change to the input in the template gives me the following error:
Error: Disallowed method "appendChild" in ShadowRoot.
Why does the onchange method not work as expected and should I go about making it work as intended?
console.log() works in playground.
You have to write this way - console.log(event.target.value)
Replace it in your code & it will print values..!!
Turns out the problem was with using console.log(). Seems that it has some issues working in the Playground.

Having problems extending Quill

I'm hitting some problems extending Quill.
I want to modify the List and ListItem classes in Quill, so I tried to copy formats/list.js into my code base as a starting point. I then import my local copy and register it with Quill like so...
import { List, ListItem } from './quill/list';
Quill.register({
'formats/list': List,
'formats/list/item': ListItem
}, true);
However, when I attempt to create a list in the editor the code crashes in the List class with the following error:
ParchmentError {message: "[Parchment] Unable to create list-item blot", name: "ParchmentError"}
This happens on this line... https://github.com/quilljs/quill/blob/develop/formats/list.js#L99
I assume it relates to the imports I was forced to change, but I can't figure out what's wrong. I've not made any other changes to list.js. The original file has the following:-
import Block from '../blots/block';
import Container from '../blots/container';
Which I changed to this:-
import Quill from 'quill';
let Block = Quill.import('blots/block');
let Container = Quill.import('blots/container');
Is the way I am importing wrong? What is causing the error?
Figured it out (well a colleague did).
I needed to import Parchment like so :-
let Parchment = Quill.import('parchment');
instead of import Parchment from 'parchment';
This is because you'll end up with a different static Parchment class to the one used internally to Quill, so asking Quill for it's instance ensures you are both working with the same one (ie, the one where the blots were registered).
I came across that problem a couple hours ago.
In Quill's source code, List is a default export while ListItem is a named export.
So your import should look like this:
import List, { ListItem } from './quill/list';
Be sure to export them appropriately on your custom list.js file.
Good luck!

Create and modify collections in a package

I'm trying to create a collection within a package (technically within a build plugin):
StaticCollection = new Mongo.Collection(null)
// also the same with Mongo.Collection('static')
StaticCollection.insert({stuff: 'thing'})
But this throws essentially this error:
While loading plugin `compileMarkdownFiles` from package `faichenshing:collection-files`:
packages/compileMarkdownFiles/plugin/compile-md.js:29:1: Mongo is not defined
at Package (packages/compileMarkdownFiles/plugin/compile-md.js:29:1)
at <runJavaScript-268>:121:4
at <runJavaScript-268>:128:3
This didn't work as Meteor.Collection either.
Then I tried to import the mongo collection into my build plugin like this:
Package.registerBuildPlugin({
name: "compileMarkdownFiles",
use: ['spacebars-compiler', 'mongo'],
// etc.
});
as well as in my Package.onUse:
api.use('mongo')
it throws this error:
While loading plugin `compileMarkdownFiles` from package `faichenshing:collection-files`:
packages/ddp/stream_server.js:3:1: __meteor_runtime_config__ is not defined
at self (packages/ddp/stream_server.js:3:1)
at <runJavaScript-83>:694:4
at <runJavaScript-83>:4779:3
No amount of searching for __meteor_runtime_config__ has clarified this problem. It seems completely unrelated.
Questions like this one seem to not run into this problem at all.
The more I think about this the more convinced I am it has something to do with the existence of a build plugin in this code, but the collection definition isn't taking place within registerSourceHandler or anything.

neo4jphp: Cannot instantiate abstract class Everyman\Neo4j\Transport

maybe a simple question but for me as starter with Neo4j a hurdle. I installed the neo4jphp with composer in the same directory as my application. Vendor-Subfolder has been created and the everyman/neo4j folder below is available. For a first test I used this code snippet from the examples:
spl_autoload_register(function ($className) {
$libPath = 'vendor\\';
$classFile = $className.'.php';
$classPath = $libPath.$classFile;
if (file_exists($classPath)) {
require($classPath);
}
});
require('vendor/autoload.php');
use everyman\Neo4j\Client,
everyman\Neo4j\Transport;
$client = new Client(new Transport('localhost', 7474));
print_r($client->getServerInfo());
I always stumple upon the error
Fatal error: Cannot instantiate abstract class Everyman\Neo4j\Transport
Googling brought me to a comment from Josh Adell stating
You can't instantiate Everyman\Neo4j\Transport, since it is an abstract class. You must instantiate Everyman\Neo4j\Transport\Curl or Everyman\Neo4j\Transport\Stream depending on your needs
So I thought I just need to alter the use-statements to
use everyman\Neo4j\Client,
everyman\Neo4j\Transport\Curl;
but this doesnt work, debugging shows, that the autoloader only get "Transport.php" instead of "everyman\Neo4j\Transport\Curl.php". For "Client.php" its still working ("vendor\everyman\Neo4j\Client.php") so I am guessing that the use-statement is wrong or the code is not able to handle an additional subfolder-structure.
Using
require('phar://neo4jphp.phar');
works fine but I read that this is deprecated and should be replaced by composer / autoload.
Anyone has a hint what to change or had the same problem?
Thanks for your time,
Balael
Curl is the default transport. You only need to instantiate your own Transport object if you want to use Stream instead of Curl. If you really want to instantiate your own Curl Transport, the easiest change to your existing code is to modify the use statement to be:
use everyman\Neo4j\Client,
everyman\Neo4j\Transport\Curl as Transport;
Also, you don't need to register your own autoload function if you are using the Composer package. vendor/autoload.php does that for you.
Thanks Josh, I was trying but it seems I still stuck somewhere. I am fine with using the default CURL - so I shrinked the code down to
require('vendor/autoload.php');
use everyman\Neo4j\Client;
$client = new Everyman\Neo4j\Client('localhost', 7474);
print_r($client->getServerInfo());`
The folder structure is main (here are the files and the composer.json with the content
{
"require": {
"everyman/Neo4j": "dev-master"
}
}
and in the subfolder "vendor" we have the "autoload.php" and the subfolder everyman with the related content. When I run the file I come out with
Fatal error: Class 'Everyman\Neo4j\Client' not found
which does not happen when I have the autoloadfunction. I guess I made a mistake somewehere - can you give me a hint?
Thanks a lot, B
Hmmm... I was just trying around and it seems the Transport CLASS is not needed in the use-statement and the class instantiation. This seems to work:
require('vendor/autoload.php');
use everyman\Neo4j\Client;
$client = new Client();
print_r($client->getServerInfo());
also valid for having a dedicated server/port:
$client = new Everyman\Neo4j\Client('localhost', 7474);
If you have more input I would be happy to learn more - thanks, all input & thoughts are very appreciated.
Balael