Skip to main content

Posts

Showing posts from April, 2014

JavaScript function in href vs. onclick

bad: id = "myLink" href = "javascript:MyFunction();" > link text good: id = "myLink" href = "#" onclick = " MyFunction (); " > link text better: id = "myLink" href = "#" onclick = " MyFunction (); return false ; " > link text even better 1: id = "myLink" title = "Click to do something" href = "#" onclick = " MyFunction (); return false ; " > link text even better 2: id = "myLink" title = "Click to do something" href = "PleaseEnableJavascript.html" onclick = " MyFunction (); return false ; " > link text Why better? because  return false  will prevent browser from following the link best: Use jQuery or other similar framework to attach onclick handler by element's ID. $ ( '#myLink' ). click ( function (){ MyFunction (); return false ; }); $ ( 'a' ).

EXTJS4 - How to handle JavaScript Errors, server exceptions globally

One way to catch JavaScript Errors with window.onerror:   Fiddle: https://jsfiddle.net/prajavk/d0ywj710/ Handle Ext errors and Javascript errors Globally as below, Possible cases to handle: 1. success - Ext handled. 2. failure, due to communication problem - Ext handled. 3. failure, due to server-side exception – developer have to handle response failures... Fiddle:  https://fiddle.sencha.com/fiddle/1gsq Solution1: Write below method in your Application controller. //Ajax Response Error Handler Ext.Ajax.on('requestexception', function(conn, response, options, eOpts) {                          var error = response.status + ' - ' + response.statusText;                          console.log('Ajax Request Exception! '+error);                          if (response.status != 200) { var errorData = Ext.JSON.decode(response.responseText);  console.log('ajax req error:'+errorData.message);                       console.log

Sencha Training is Coming to India

Course Description This hands-on Fast Track course provides in-depth coverage of Ext JS 4 and Sencha Architect 3 including: App Architecture and Sencha  MVC Developing complete Ext JS 4 Applications with Sencha Architect 3 Sencha Cmd UI Components and Views The Class System Components, Containers and Layouts Data Models, Stores, and Proxies Data Aware Components Grids, Trees, Data Views, Forms, Charts Controllers Theming Production Builds This Fast Track course includes all of Essential Ext JS plus: Model Associations, Trees, Grid Editing, Charting, Theming,  DOM  Manipulation, and more advanced  MVC Trees Grid Editing DOM  Manipulation Custom Component Development Advanced  MVC Through intensive hands-on labs, you will learn application architecture best practices and build a functioning application with an Ext JS 4 user interface connecting to live data feeds using  JSON . Developers report saving at least 3-4 weeks learning Ext JS by taking this cou