|
Subscribe
|
Hi, I downloaded the Coolite.ux.InputMask and me interested in creating a plugin to edit values (R$ 324.55 for example). Following the model of InputMask tutorial and the link: http://extjs.com/learn/Manual:Intro:Inheritance. I started a plugin MyCurrency as the code below to test.
MyCurrency.cs
/******** * Copyright (c) 2008 Coolite Inc.
* Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
* @version: 0.7.0 * @author: Coolite Inc. http://www.coolite.com/ * @date: 2008-11-21 * @copyright: Copyright (c) 2006-2008, Coolite Inc, or as noted within each * applicable file LICENSE.txt file * @license: MIT * @website: http://www.coolite.com/ ********/
using System.ComponentModel; using System.Web.UI; using Coolite.Ext.Web; using System.Drawing;
namespace Coolite.Ext.UX { /* * MyCurrency */
[InstanceOf(ClassName = "Ext.ux.netbox.MyCurrency")] [ClientScript(Type = typeof(MyCurrency), WebResource = "Coolite.Ext.UX.Plugins.MyCurrency.resources.MyCurrency.js")] [ToolboxBitmap(typeof(Coolite.Ext.UX.MyCurrency), "Build.Resources.ToolboxIcons.Plugin.bmp")] [ToolboxData("<{0}:MyCurrency runat=\"server\" />")] [Description("MyCurrency plugin used for mask/regexp operations")] public class MyCurrency : Plugin { [ClientConfig] [Category("Config Options")] [DefaultValue("")] [NotifyParentProperty(true)] [Description("The MyCurrency")] public string Simbol { get { object obj = this.ViewState["Simbol"]; return obj == null ? "" : (string)obj; } set { this.ViewState["Simbol"] = value; } }
} }
MyCurrency.js
Ext.namespace('Ext.ux.netbox'); /* * MyCurrency * */ Ext.ux.netbox.MyCurrency = function(simbol) { var simb = simb.Simbol; }; Ext.extend(Ext.ux.netbox.MyCurrency, Ext.form.TextField, { theDocument: Ext.get(document), myCurrencyFn1: function() { // etc. }, myCurrencyFn2: function() { // etc. } }); Ext.ux.MyCurrency = Ext.ux.netbox.MyCurrency; I put the plugin on the page and run the error occurs:
Ext.ux.netbox.MyCurrency is not a constructor
Any tips? Thank you. Maia.
|
|
|
Hi Maia,
Can you confirm that the .js file loads on initial page_load?
--
Geoffrey McGill
Coolite Inc.
Development Team
Skype : geoffrey.mcgill
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
|
|
|
Hi, I just registered the assembly, as did the InputMask.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FrmProspect.ascx.cs" Inherits="CRMWeb.View.frmProspect" %> <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Assembly="Coolite.Ext.UX" Namespace="Coolite.Ext.UX" TagPrefix="ux" %>
|
|
|
|
Any Help?
|
|
|
Hello Maia
First: Your plugin is extending Ext.form.textfield? Why? It's a plugin or a sub-class?
Try see better full code of InputMask (http://code.google.com/p/cherryonext/source/browse/trunk/src/netbox/InputTextMask.js).
Second question:
Try something like
Ext.ux.netbox.MyCurrency = function(simbol) { var simb = simb.Simbol; };
Ext.ux.netbox.MyCurrency.prototype = { fn1: function(){}, fn2: function(arg1, arg2){} };//Finally Ext.ux.MyCurrency = Ext.ux.netbox.MyCurrency;
Third:
If you plan extend coolite (c# and javascript) components, some modifications are needed:
Please verify the topic http://www.coolite.com/forums/Topic15147-7-1.aspx
|
|
|
|