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 / 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
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 / MainController.js
Last active Oct 13, 2017
Securing routes in Extjs 6
View MainController.js
Ext.define('App.controller.MainController', {
routes: {
'home': {
before: function(action) {
url: Config.endpoints.user,
method: 'GET',
scope: this,
failure: function(data, operation) {
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 / 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 Dec 19, 2019
AngularJs | Directive for Auto Focus Next element on Enter
View app.js
var app = angular.module("myApp", []);
app.directive("moveNextOnEnter", function() {
return {
restrict: "A",
link: function($scope, element) {
element.bind("keyup", function(e) {
if (e.which == 13) {
var $nextElement =;
if($nextElement.length) {
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 / 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 / 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 10, 2016
Adding a loading spinner at app startup in Sencha Architect
View app.js
You can’t perform that action at this time.