Javascript

Leave Page Alert When Form Field Changes

This demo will show you how to monitor the form field changes, and display a message box when user try to leave the page before the submit form.

Install Node.js on CentOS and Fedora

The install of Node.js is pretty straight forward, with on gotcha when it comes to installing node packages that I will detail at the end. If you haven’t already installed developer tools, you will need to do that now. Now install Node.js. Problem installing node packages with sudo To install node packages you have a little problem if you are using sudo. On Fedora and CentOS 6.2 (and probably versions less than this), sudo has a secure path set secure_path = /sbin:/bin:/usr/sbin:...

Move copy delete options between Select Menus with Javascript

This javascript snippets perform certain tasks like select one or more of the options, move them or copy or delete between two select menus. You can bookmark the article and use the code whenever you need them. Click here for the online demo.

ExtJS4 Viewport Example

This is an simple example to show you how to create a viewport in ExtJs4. The Viewport renders itself to the document body, and automatically sizes itself to the size of the browser viewport and manages window resizing. There may only be one Viewport created in a page. The Viewport does not provide scrolling, so child Panels within the Viewport should provide for scrolling if needed using the autoScroll config. Unlike the panel component of Ext JS, Viewport does not have a tbar option. ...

ExtJS4 : read posting JSON data in PHP

I am working on a Ext-JS web application which needs to send data to the PHP server side to store. It took me a while to find out how to decodes the receiving JSON string in PHP. Ext-JS Assume you have a model and calling save to send a ajax request. PHP If you use $_POST variable to pass the JSON string, you won’t see anything. It is just an empty array. This is because the Content-Type in the Request packet is different now, application/json. The JSON expression string in the...

ExtJS4: Add Custom Right Click Menu in MVC

The way to create a custom menu in mouse right click event function in ExtJS 4 is little different with pre-version. It seems in Ext 4.0.2 they changed event name and arguments order. First, let's see how we create the menu in Ext 3. I get this example from aditia rahman: Let's write a DataView to add a listener. When the data view is rendered it disabling the default right click web browser menu, this is called in listeners “render” event and “contexmenu” event is for detectin...

Using Global variables and arrays in Extjs 4

This example will show you how to declare a global var and arrays in Extjs MVC application. You know where to find this code : Global application variable : Simple, right? Now you can access this variable everywhere in your mvc application. If you need arrays , try this:

ExtJS4学习笔记 PHP代码

笔者在ExtJS4学习笔记原文中使用的服务器端代码是ASP的,我把它转成了PHP的。方便PHP的爱好者使用。代码如下:

Extjs- Ext.extend函数的使用

Ext.extend在Extjs 中扮演着重大角色,是Extjs中几个重要函数之一。要想深入了解EXTJS,这个函数非掌握不可,网上有很多关于这个函数的源码分析和介绍方面的文章,这里我只总结关于这个函数的使用的下几种情况,不详细分析这个函数的源码。 Example one: 当在这种情况下的时候 此时Base是base父类,两者均有自己的构造的函数.当采用这种方式构成继承关系时,实例化base时将会先调用base constructor随后调用Base constructor.在EXTJS中采用这种方式构造继承关系例如 Example two: 当在这种情况下的时候 此时Base是base的父类,实例化base时将会调用Base 的constructor.在EXTJS中采用这种方式构造继承关系例如 Example three : 当在这种情况下的时候 此时Base是base的父类,实例化base时将会调用 literal object 中的constru...

Sorting a two dimensional array in javascript

Sorting arrays in JavaScript is done via the method array.sort(). Passing in a function reference into array.sort() As touched on already, array.sort() accepts an optional parameter in the form of a function reference (lets call it sortfunction). The format of this function looks like this: When such a function is passed into array.sort(), the array elements are sorted based on the relationship between each pair of elements "a" and "b" and the function's return value. The three poss...