View Full Version : [CLOSED] Extending ExtJS class and Ext.Net Markup

Feb 09, 2015, 6:51 AM

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,

Feb 09, 2015, 7:50 AM
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 ?

Feb 09, 2015, 12:17 PM
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?

Feb 09, 2015, 1:42 PM

Feb 09, 2015, 2:51 PM

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