Skip to main content

Posts

Showing posts from February, 2014

Grid RowExpander plugin: expandOnlyOne, to auto collapse the last expanded row

RowExpander Addon: expandOnlyOne It's just a little addon for RowExpander plugin which adds two features: the ability to only have one expanded row and to collapse the last expanded row. Code: GridPanel definition: Ext.require([      'Ext.data.*',  'Ext.grid.*',  'Ext.ux.RowExpanderPlus' ]); Ext.define('MyApp.view.MyGridPane', { extend : 'Ext.grid.Panel', ...... plugins: [{             ptype: 'rowexpanderplus',             selectRowOnExpand : true, //true to select a row when clicking on the expander icon             expandOnDblClick: true, //true to toggle a row between expanded/collapsed when double clicked             rowBodyTpl : [  ] ]} ..... .... ]); ux/RowExpanderPlus.js MVC pattern  : paste this js code in above path and declare in path  in loader.js \ General App : ...

ExtJs 4 convert String to Date Example

Your date may be a numeric value or String data as a JSON response to a Server request. Now having that value converted to a date has its advantages. All you have to do is check the object if it has the getMonth() method. If it does that means its already a date object otherwise just use the parser along the date format. Here is how to do it ? 1 2 3 4 5 6 7 8 9 function convertMyDate(value) {      //check if the input value is already a date      if (!value.getMonth){          //if not a date then convert it to date          //specify the format, so if the value is 20120229 then use Ymd format          value = Ext.Date.parse(value, 'Ymd' );      }      return   value; } Ext.Date.parse( String input, String format, [Boolean strict] ) : ...