[CLOSED] Extending ExtJS class and Ext.Net Markup

  1. #1

    [CLOSED] Extending ExtJS class and Ext.Net Markup


    I need to modify a few bits and bobs in the combo box behavior. I will extend ExtJS combo box class and call it e.g. "ComboBoxEx".

    Is it possible to "assign" somehow a new (extended) ExtJS class (in this case my ComboBoxEx) to one of <ComboBox> Ext.Net markup (so I don't have to create it from directly from java script) ?

    Thank you,
    Last edited by Daniil; Feb 17, 2015 at 12:57 PM. Reason: [CLOSED]
  2. #2
    Correct me if I am wrong, there is no e.g. Attribute in Ext.Net markup that I could directly use to replace "Ext.form.field.ComboBox" to my own ExtJS class.

    I have added my own class and markup definition.

    public class ComboBoxEx : Ext.Net.ComboBox

    Registered the assembly in web config and added reference in my markup:

    <%@ Register Assembly="MyApp.Controls" Namespace="MyApp.Controls" TagPrefix="myCtrls" %>

    This is working fine. I can replace markup with my own.

    Now the question is how to replace ExtJs class behind ?

    I have found that in ComboBox.cs:

    [Category("0. About")]
    public override string InstanceOf
            return "Ext.form.field.ComboBox";
    But it is never called. Is it only some "informational" property ?
  3. #3
    InstanceOf will be used by the Ext.NET framework code to instantiate an instance on the client side, e.g. when it generates the required initialization scripts.

    But sometimes, it will use xtype (when lazy instantiation is needed), e.g. if a component is added to an items collection of a container.

    So you should override both InstanceOf and XType.

    Here is a small example (not run or tested it, just from memory!)

        public class FeedbackWindow : Window
            public override string XType { get { return "myfeedbackwindow"; } }
            public override string InstanceOf { get { return "Ext.ux.MyFeedbackWindow"; } }
            ... all your customizations here
    And then the corresponding JavaScript class:

    Ext.define('Ext.ux.MyFeedbackWindow', {
        extend: 'Ext.window.Window',
        alias: 'widget.myfeedbackwindow',
        initComponent: function() {
            // your custom initialization here
        ... any further customization to your subclass here
    You can see the xtype matches the big after the alias's "widget" part.

    Worth looking at the sencha docs and examples of use of xtype, etc.

    Hope that helps?
  4. #4
    Geoffrey McGill
  5. #5

    Close please


    Thank you both. That works great... I can start working on my new "widget" now :)


Similar Threads

  1. [CLOSED] extending textfield
    By metci in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 02, 2014, 6:30 AM
  2. Replies: 3
    Last Post: Feb 20, 2014, 4:24 AM
  3. Replies: 1
    Last Post: Oct 25, 2012, 5:14 AM
  4. Extending DatePicker
    By onurbozkurt in forum 1.x Help
    Replies: 0
    Last Post: Apr 29, 2009, 8:45 AM

Posting Permissions