Skip to content

Instantly share code, notes, and snippets.


Rattan Chauhan rattanchauhan

Block or report user

Report or block rattanchauhan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rattanchauhan / Sencha 4
Created Oct 7, 2016
Saving component state in LocalStorage in Sencha Architect
View Sencha 4
Create a function init under Application and add the below code to initialze a state provider to store states of different components
in the browser's local storage.
// initialize state provided for saving component states
Add the below two configs to the component you want to save the state for.
rattanchauhan / app.js
Last active Nov 6, 2016
Setting global default ajax timeout through Sencha Architect
View app.js ({
timeout: 300000
withCredentials: false,
useDefaultXhrHeader: false,
timeout: 300000
rattanchauhan / app.js
Last active Nov 6, 2016
Adding global exception handler through Sencha Architect.
View app.js
requestexception: function(dataconn, response, options) {
if (response.status === 401) {
rattanchauhan / formatXml.js
Created Nov 10, 2016
Utility method to format an xml string
View formatXml.js
* Utility method to format an xml string
* text : xml String
* step : no of spaces for indentation
formatXml : function(text,step) {
function createShiftArr(step) {
var space = ' ';
if ( isNaN(parseInt(step)) ) { // argument is string
rattanchauhan / app.js
Last active Nov 10, 2016
Adding a loading spinner at app startup in Sencha Architect
View app.js
rattanchauhan / ViewController1.js
Last active Nov 14, 2016
Adding gmaps to extjs app
View ViewController1.js
addGmap: function (googlemapcontainer, viewModel) {
var mapcontainer = googlemapcontainer.down('#mapcontainer');
// remove old map
if(mapcontainer) {
// create new map
rattanchauhan / Usage.js
Last active Nov 16, 2016
Capturing User details for re-using throughout a Sencha app
View Usage.js
onMenuPanelRenderer : function() {
var hasWebRole = User.hasRole(Config.role.web);
var hasAdminRole = User.hasRole(Config.role.admin);
if (hasWebRole) {
// set mentu item visible true based on role
if (hasAdminRole) {
// set mentu item visible true based on role
rattanchauhan /
Last active Nov 24, 2016
Java8 features in practice
package com.practice.test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Predicate;
rattanchauhan / Application.js
Last active Jan 11, 2017
Saving Grid state in Extjs
View Application.js
// init method
init: function() {
// initialize state provider for saving component states
rattanchauhan / Poller.js
Created May 30, 2017
Extjs Poller utility
View Poller.js
Ext.define('Empty.common.Poller', {
singleton: true,
alternateClassName: ['Poller'],
* Utility to poll an endpoint provided with the required parameters
* Mandatory parameters are : params.pollInterval, params.pollTimeout, params.success
* @params {Object} params
You can’t perform that action at this time.