What can we use instead of addEvents to add an event to the extended class?
this.addEvents({
"itemclick" : true
});
Since ExtJS 5.0.0 it is no longer required to call addEvents before fireing events. So when you upgrade to ExtJS 5 or newer just delete all calls of addEvents method.
Observable ExtJS 5 docs
Related
The following add-ons are supported till Vaadin 8. Are they compatible for Vaadin 14 or 23? If not, any alternative option available?
I have searched both Vaadin Directory and component factory, but cannot find anything similar to this.
May be naming is different, and I cannot find correct alternative.
https://vaadin.com/directory/component/switch
and
https://vaadin.com/directory/component/sizereporter
Thank you
The replacement for Switch add-on is the ToggleButton
https://vaadin.com/directory/component/togglebutton-for-flow
For getting actual size of the component you no longer need an add-on, but can use the JavaScript call with return value callback.
Button button = new Button("display width");
button.setWidth("45%");
button.addClickListener(event -> {
button.getElement()
.executeJs("return $0.clientWidth", button.getElement()).then( width -> {
Notification.show("Button width "+ width.asNumber());
});
});
add(button);
We migrated our JSF 2.2 based application to JSF 2.3, Except of some smaller issues we were able to get everything up and running. For one view we use Butterfaces JSF component, especially the tree component. With JSF 2.3 it was not possible to select a node and to show details of that node in another container. The apprropriate Ajax request sends the id of the node as options.params. That worked fine with JSF 2.2 but is not working anymore with JSF 2.3. We are still on Butterfaces 2 ( which should work due to downward compatibility), but even in the showcase of Butterfaces 3 on Java EE 8, the select via Ajax seems not to work.
I had a look on the jsf.ajax.request Javascript method of JSF 2.3, debugged it and realized, that the param was ignored and deleted since it seems to be the wrong format. Thus, I monkey patched the method in our application with this little stupid code snippet, to get the param sent to the server via the ajax request:
var originalJsfAjaxRequest = jsf.ajax.request;
jsf.ajax.request = function (source, event, options) {
options.params = {params: options.params};
originalJsfAjaxRequest.apply(this, [source, event, options]);
}
That's it, it is working fine again.
So my question is, where the problem is supposed to be. Is it a problem in JSF to ignore these sort of params. Or is it a problem of Butterfaces using the parameters in a wrong way? What is the correct way, to use options.params?
Thanks in advance
I don't know why, but JSF 2.3 ignores param attribute when using jsf.ajax.request. There is an ButterFaces issue: https://github.com/ButterFaces/ButterFaces/issues/232 and a new release will be released this or next week.
How to destroy dropdzonejs?
When I have SPA and leave the page, I want to clean up so it does not listen to body events anymore.
myDropzone.destroy();
I swear I had the same problem and I'll find that with a
lucky attempt... it works!
I removed removedfile() function from Dropzone options and myDropzone.destroy(); worked for me.
According to the documentation:
If you do not need a dropzone anymore, just call .disable() on the
object. This will remove all event listeners on the element, and clear
all file arrays. To reenable a Dropzone use .enable()
If you initialize dropzone like:
var myDropzone = new Dropzone("#mydropzoneid", { url: "/some/url"});
You should be able to disable it with:
myDropzone.disable();
Use one of the following methods : The destroy() and disable() methods both exist, and they seem to act the exact same way.
In fact, DropZone does not have a real destruction method. These methods will "put the instance in pause" (what is, by design, the closest implementation of a DropZone instance destruction).
This applies to DropZone 5.x and DropZone 6.x (try myDropzone.disable() or myDropzone.destroy() in the console on this v6.x example page https://www.dropzone.dev/bootstrap.html) : The DropZone instance will be disabled, thus leading to the "Add Files..." button being inoperative.
The instance can then be re-enabled by calling myDropzone.enable().
PS : DropZone switch from v5 to v6 in 2021-2022. The website was completely revamped and screwed-up: the documentation is partial, incomplete, too short.
If you still need to access the excellent and exhaustive v5 documentation, you can head up to the obvious Web Archive Wayback machine ! Here is the very latest v5 documentation page https://web.archive.org/web/20210829160314/https://www.dropzonejs.com/
If you want destroy all dropzone instances just add if (Dropzone.instances.length > 0) Dropzone.instances.forEach(dz => dz.destroy()) to document ready.
I just download a trial version of v2013.3.1119.440 of the Kendo UI wrappers for ASP.NET MVC. I see a new Kendo.Mvc.UI.Fluent.ButtonBuilder wrapper in this version that wasn't in the version I had downloaded just 20 days ago on another PC.
The said wrapper represents a button.
I can't see a way to directly wire this Kendo.Mvc.UI.Fluent.ButtonBuilder wrapper with a server side MVC action. How do I do that?
I do see the Events method on the ButtonBuilder class, which accepts a Action<ButtonEventBuilder> events. In the ButtonEventBuilder, I see another method called Click, which has two overloads, but both are for wiring client side event handlers of the button.
I don't see a way to directly wire up a server side call-back/post-back with the button click.
Am I missing something? Is the only way to do it the manual way of firing the server side post back or call back from a JavaScript function?
The Button is new in the latest release of Kendo UI (last week). It doesn't directly support what you're looking for, but something similar could be accomplished like this:
#(Html.Kendo().Button()
.Name("textButton")
.Content("Text button")
.HtmlAttributes( new {type = "button"} )
.Events(ev => ev.Click("onClick")))
Then a JS function similar to this:
function onClick(){
$.ajax({
url: '/controller/action'
data: { // data here }
}).done(function(result){
// do something with the result
}).fail(function() { // handle failure });
}
More info can be found in their demo site: http://demos.kendoui.com/web/button/events.html
I'm currently trying to make the jquery tokeninput plugin zepto compatible.
according to the zepto documentation in version 1.0 there should be a function called $.type() (i'm using the latest 1.0rc)
but whenever i try to call this function i recieve the following error:
Object function (a,b){return w.init(a,b)} has no method 'type'
has someone has a quick answer/fix for that?
thx
in my case typeof() did the job for my needs.
since zepto is finally out in version 1.0 it has $.type support as well.