Skip to content

Instantly share code, notes, and snippets.

Avatar

Marco Celotti mcelotti

  • Udine
View GitHub Profile
@mcelotti
mcelotti / GridPagingToolbar.js
Last active Aug 6, 2017
ExtJS6 Modern: Ext.grid.plugin.PagingToolbar that interacts with grid's store
View GridPagingToolbar.js
/**
* When I first used the "Ext.grid.plugin.PagingToolbar" plugin with ExtJS6.2 modern I thought it could interact and load prev/next pages using the grid's store.
* The fact is that the pagingtoolbar does not interact with the store, it splits "pages" of data within the current grid data, but this is not what I was looking for.
* Therefore here's my attempt to extend the PagingToolbar and create a paging plugin that actually loads store pages according to the slider.
*/
Ext.define('MyApp.util.GridPagingToolbar', {
extend: 'Ext.grid.plugin.PagingToolbar',
@mcelotti
mcelotti / android_forward_result
Last active Nov 2, 2021
Android FLAG_ACTIVITY_FORWARD_RESULT howto
View android_forward_result
Nav flow is: A => B => C => A with results from C
If you're using fragments please note that "onActivityResult" will be called according to where "startActivityForResult" is called (method "startActivityForResult" is available in both, activity and fragment)
ActivityA
startActivityForResult(intentB, 22);
ActivityB
intentC.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
startActivity(intentC);
finish();
@mcelotti
mcelotti / Model.js
Last active Nov 20, 2015
Sencha Touch 2.4.2 override validate() to pass model and allow cross-field validation
View Model.js
Ext.define('MyApp.override.data.Model', {
override : 'Ext.data.Model',
/**
* @override
* we want to pass the model (not only config and value)
*/
validate : function() {
var errors = Ext.create('Ext.data.Errors'),
validations = this.getValidations().items,
View Ext.ux.TimestampIdentifier.js
Ext.define('Ext.ux.TimestampIdentifier', {
alias : 'data.identifier.timestamp',
config : {
negative : false,
string : true
},
constructor : function(config) {
this.initConfig(config);
View Ext.ux.Base64.js
//jshint camelcase:false
Ext.define('Ext.ux.Base64', {
singleton : true,
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode : function(e) {
var t = "";
var n,
r,
i,
View Ext.ux.CanvasImage.js
(function() {
var drawImage = function() {
var imageData = this.getImgData();
var maxWidth = this.getWidth();
var maxHeight = this.getHeight();
if (imageData && maxHeight && maxWidth) {
var img = document.createElement("img");
img.src = imageData;