How to use plugins in Extjs - extjs4.2

I am finding it very difficult to use 'Ext.ux.TabReorderer' as a plugin in tab panel
Ext.define("practical.view.Board",{
extend: 'Ext.tab.Panel',
alias: 'widget.board',
plugins: ['Ext.ux.TabReorderer'],
items:[{
title: 'Tab 1'
},{
title: 'Tab 2'
}]
});
This was throwing an console error saying:
Cannot read property 'init' of null
Upon further investigation found that there is no folder called 'ux' in my extjs. Also a quick search showed me that there is a file named 'Ext.ux.TabReorderer.js' in 'extjs\docs\output' folder.
This is confusing me, how do I add this plugin to my tab panel ?
Edit:
After going through the link provided in the comments by DSF
I added Path in app.js
Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext.ux': './app/ux'
}
});
Also changed the tab panel to include
Ext.require(['Ext.ux.TabReorderer']);
Ext.define("practical.view.Board",{...
...
It is now giving me new errors :
1) Uncaught TypeError: Ext.data.JsonP.Ext_ux_TabReorderer is not a
function (TabReorderer.js)
2) Uncaught Error: The following classes are not declared even if
their files have been loaded: 'Ext.ux.TabReorderer'. Please check the
source code of their corresponding files for possible typos:
'./app/ux/TabReorderer.js (ext-all-dev.js)

I was finally able to fix it.
I moved TabReorderer.js from extjs\docs\output folder to extjs\src\ux.
The reason this didn't work earlier was because I was providing a class name inside the plugins array.
plugins: ['Ext.ux.TabReorderer']
Where it should have been an instance of that class, as shown below
plugins: [Ext.create('Ext.ux.TabReorderer')]
Another way to add plugins would be to use a ptype. For example
plugins: [{ptype: 'cellediting'}]
One can find a list of all the ptypes in Sencha docs
Unfortunately there is no ptype for TabReorderer, so had to stick with Ext.create().
For further reading
http://www.sencha.com/blog/using-plugins-and-mixins-in-your-sencha-apps/

Related

Identifier expected.ts(1003) with Alpinejs and Astro

I'm using Aplinejs (3.11.1) with Astro.build (2.0.13) and have the following on a div
x-on:click.outside="shownav = false"
I'm getting the following error in VS Code (1.74.3) on the "."
Identifier expected.ts(1003)
I'm new to VS Code, Alpine and Astro, so I'm not sure how to get rid of this error. Can someone advise? I'm using TypeScript 4.9.5.
Separate but related, for anyone getting the following error on "outside":
Property 'outside' does not exist on type 'HTMLAttributes'.ts(2322)
I sorted that by adding this to src/custom-attributes.d.ts
declare namespace astroHTML.JSX {
interface HTMLAttributes {
outside?: string;
}}
Version of the Astro VS Code extension lower than 0.29.0 don't support Alpine correctly. (See this issue)
At the time of writing, 0.29.0 is only available in Pre-release. You can update to it by pressing the Switch to Pre-Release button on the extension page.
Screenshot of the extension page

How to use stage 3 syntax in svelte/sapper?

I want to use class property and private fields in my sapper project. Apparently they have to be preprocessed by babel right now.
I tried to add the corresponding babel plugins to rollup.config.js, only to realize a few things.
the babel rollup plugin is only used in legacy mode.
the server part doesn't use babel at all.
I tried to add the babel rollup plugin to the end of server plugins like this,
babel({
extensions: ['.js', '.mjs', '.html', '.svelte'],
runtimeHelpers: true,
exclude: ['node_modules/#babel/**'],
plugins: [
'#babel/plugin-proposal-class-properties',
'#babel/plugin-proposal-private-methods',
],
}),
But it doesn't seem to take effect at all.
I also added it to the client plugins (before the legacy entry), but it complained about I needed to add #babel/plugin-syntax-dynamic-import, so looks like babel has to recognize the whole syntax in order to preprocess, and I don't really want to compile dynamic import for modern browsers.
How do I enable the use of esnext syntax in sapper?
You would need to preprocess the contents of <script>, using the preprocess option in rollup-plugin-svelte:
plugins: [
svelte({
// ...
preprocess: {
script: ({ content }) => {
return transformWithBabel(content);
}
},
// ...
})
]
In an ideal world we'd have a ready-made preprocessor plugin for doing this; as it is, the transformWithBabel function is left as an exercise to the reader for now. Essentially it would involve import * as babel from '#babel/core' and using the Babel API directly, which I guarantee will be lots of fun.
Note that #babel/plugin-syntax-dynamic-import doesn't compile dynamic import, it only allows Babel to parse it. Without it, Babel can't generate a valid AST from the code inside <script>.

SAP UIveri5 Minimum example

I am trying to understand how UIveri5 works and how to apply it to my own projects, but due to the minimal documentation I am unable to create a minimal working example.
I tried to apply the code from https://github.com/SAP/ui5-uiveri5/blob/master/README.md to "my" minimal app ( https://ui5.sap.com/1.62.0/#/sample/sap.m.sample.Button/code/ ), but the IDE VS Code marks errors, since i.e. the commands export or define are not known and I don't see where UIveri5 loads them from. Also if I just execute uiveri5 in my command line as is, I am getting an error ( I guess from selenium ) that my Chrome binary is missing, but don't the drivers get downloaded automatically?
conf.js
exports.config = {
profile: 'integration',
baseUrl: 'localhost:8080/.../sap.m.sample.Button',
};
page.spec.js
describe('Page', function () {
it('should display the page',function() {
element(by.control({
viewName: 'sap.m.sample.Button.Page',
controlType: 'sap.m.Page',
properties: {
title: "Page"
}}));
});
});
It would be awesome if someone already build a minimal example and can share it. It would help me very much in understanding how everything works together.
The minimum example is right in the readme.md. The only problem I see here is with the baseUrl - this should be a valid URL to an existing app. If this is a sample app on your localhost, you need a dev server.

Where are the docs on how to add symbol support for a language to Visual Studio Code?

I would like to add symbol support for PowerShell to VS Code but I'm not finding any docs on the code.visualstudio.com/docs site.
Also, is it possible to do this for a language like PowerShell that, for the moment, will only work on Windows? Is there a way to light up symbol support on Windows only?
BTW I've added a bunch of PowerShell snippets that I'm in the process of trying to get integrated into VS Code. Any help on how to get these snippets into the product would be appreciated as well? I did submit an issue on the snippets, suggesting that the team put these into VS Code.
There is currently no documentation for the plugin API. It's too early for this as the API is still changing with every minor release. The VSCode team is focused on providing a stable plugin API. There will be a documentation about it when it's done.
Nevertheless it is already possible to add a new language plugin or extending an exisiting one. Take a look on this short description on how to add declaration support for a new language: Create Custom Language in Visual Studio Code
You could add symbol support in a similar way. What you need is something like an abstract syntax tree builder for powershell scripts and an application or a javascript module that is able to process a JSON request in order to provide the correct symbols. An example request for outline support is this:
{
"seq":442,
"type":"request",
"command":"navbar",
"arguments":
{
"file":"c:/Users/C/Documents/projects/MyProject/MyFile.xxx"
}
}
A response could look like that:
{
"seq":442,
"type":"response",
"command":"navbar",
"request_seq":442,
"success":true,
"body":[
{
"text":"TObjA",
"kind":"class",
"kindModifiers":"",
"spans":[
{
"start":{
"line":10,
"offset":3
},
"end":{
"line":16,
"offset":4
}
}
],
"childItems":[
]
},
{
"text":"DoSomething",
"kind":"method",
"kindModifiers":"",
"spans":[
{
"start":{
"line":20,
"offset":1
},
"end":{
"line":27,
"offset":4
}
}
],
"childItems":[
]
},
]
}
I'm not sure what do you mean with "symbol support". Is it something like "jump to symbol inside the current file" using CTRL+Shift+O? Then you are looking for outlineSupport.
Is it something like "find a symbol in any file" using CTRL+P, #? Then you are looking for navigateTypesSupport.
Copy the needed .js file from the vs.langauage.csharp.o folder to the vs.langauage.powershell folder and register the support in powershellMain.js as it is done in omnisharpMain.js.
If you want to register the new support only on Windows then you can do it like this:
var isWin = /^win/.test(process.platform);
if(isWin)
monaco.Modes.NavigateTypesSupport.register('powershell', new navigateTypesSupport_1.default(ModelService, server));
I hope this helps for the moment. Don't forget to save your changed plugins in a different folder. VSCode often deletes changes in the plugin folders on update.

sails.js : using dust in sails 0.10.5

I am trying to migrate a project from 0.9.9 to 0.10.5
We were using dust templating engine in our porject instead of the default ejs engine.
Contents of config/views.js file
module.exports.views = {
engine: 'dust',
layout: 'layout'
};
In my controller, I was able to render this view like this
res.view('layout', obj);
However, in sails 0.10.5, when I lift sails, first of all I get this warning
warn: Sails' built-in layout support only works with the `ejs` view engine.
warn: You're using `dust`.
warn: Ignoring `sails.config.views.layout`...
And then when I try to render the view as I was doing earlier, I get following error:
error: Sending 500 ("Server Error") response:
Error: ENOENT, open '/.dust'
{ [Error: ENOENT, open '/.dust'] errno: 34, code: 'ENOENT', path: '/.dust' }
Any idea what is the correct way of doing this in 0.10.5 ?
The layout property does not apply to dust (just ejs). Set layout to false to get the warning to go away. You want to use Dust's built-in support for partials and blocks anyways.
Using res.view('layout', obj); means that you expect a file called views/layout.dust to exist. Prior to 0.10, sails was including the layout property from config/views.js as part of the path.
So my best guess is that your res.view() call is actually being invoked with an empty string as the first parameter, and it wasn't breaking because you were trying to render something called layout. I'd check your invocation to make sure that you're calling res.view() with an instantiated variable.