Results 1 to 2 of 2

Thread: Fully functional custom type

  1. #1
    Sencha User
    Join Date
    May 2013

    Default Fully functional custom type


    I'm looking for the best way to define own custom type in ExtJs.
    I would like to use it in forms, grids, pivots, etc., it should has own rendering, calculating and sorting behavior.

    Consider a type 'pace'. Pace is defined as amount of time needed to move on unit of distance, for example pace 2:30 means you need two and half minute to do 1 mile or km.
    Pace could be added (2:30 + 2:35 = 5:05) and be used in other calculations.
    The smaller pace is faster, that means pace 2:00 is faster (higher) than 2:30.

    So far as I know, this is a way to define own custom type and use it in data model as in coding below:
    Ext.define('App.fields.Pace', {
        extend: '',
        alias: 'data.field.pace'
    Ext.define( 'Data', {
        extend: '',
        fields: [ 
            {name: 'id'},                           
            {name: 'pace', type: 'pace'}
    Such defined type is a dummy one, it doesn't render, sort or calculate correctly.

    Is there a way to extend it, so it will work ok in forms, grids, pivots, etc.?
    What should I do to archive it? Should I define or overwrite some methods?
    Or perhaps I should take other similar type (for example date) and inherit it or use it as template?
    I think as minimum the new custom type should provide a method to convert its value to internal type like int and a method to render this internal value as external format but I havent find such methods.

    Is it possible to define own type which will work correctly in all scenarios where standard type could be used?


  2. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Sydney, Australia


    In this case you'll probably want to extend integer and override the convert/serialize methods.

Similar Threads

  1. How can I create custom property with custom type
    By JesseNone in forum Sencha Architect 2.x: Help & Discussions
    Replies: 4
    Last Post: 12 Oct 2015, 5:51 AM
  2. Ext.Map not fully functional on Android
    By dekaykim in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 21 Jun 2011, 5:56 AM
  3. Replies: 0
    Last Post: 31 Jan 2011, 3:47 AM
  4. a fully functional demo
    By userofit in forum Community Discussion
    Replies: 13
    Last Post: 28 Apr 2009, 6:47 AM
  5. Fully functional grid binding to form
    By ivanblue in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 9 Sep 2008, 3:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts