Custom attribute in editor

  1. #1

    Custom attribute in editor

    Hello

    I apologize for generic question (so likelly I will get generic answer)

    I'm trying to "connect"
    https://forums.ext.net/showthread.ph...html-attribute
    with
    https://examples5.ext.net/#/Editor/B...mPanel_Labels/

    what I would like is to render on each fieldlabel custom attribute (different value on each) and I would like to read get value of custom attribute in the var complete = function (editor, value, startValue)

    but I do not see how to get the reference to particular fieldLabel inside the beforecomplate or complete method

    Any direction please?

    Thanks
  2. #2
    Hello @Ibrohan!

    Considering the example you pointed and the forum thread, you can just go ahead and give your component a custom config with whatever value you want.

    Assuming the editor selector is always going to meet a field label from a component, on the complete() function, you can reach the component via:

    editor.boundEl.up().component.myCustomConfigName
    In case you set different CSS selectors to trigger the editor, you'd need to step in the complete() method and check how, from the editor.boundEl handle.

    This handle is the Ext.dom.Element component with the CSS selector you specify the editor to trigger from. In the case of the example, it will always be fields' inner FieldLabel elements that compose the text field.

    From this Ext JS class, it is possible reach whatever wraps it via the up() function. In our case, as it is the FieldLabel element within a Text Field, it will reach to the actual text field's Element (not the component instance itself).

    From that text field's Ext.dom.Element instance you can then reach the actual client-side component instance where you can set custom config from Ext.NET markup or code behind.

    For instance, if the CSS selector was an Ext.NET button or label, you would not need to step as the editor.boundEl would point straight to the component you want -- thus editor.boundEl.component.myCustomConfigName would suffice.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Row Editor custom/adjustable width in GridPanel
    By eldino16 in forum 3.x Help
    Replies: 0
    Last Post: Dec 21, 2015, 6:27 AM
  2. [CLOSED] Custom attribute on all controls
    By Kev in forum 2.x Legacy Premium Help
    Replies: 16
    Last Post: Dec 18, 2012, 11:20 AM
  3. [CLOSED] GridView cell editor with custom controls?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 34
    Last Post: Nov 08, 2012, 8:29 AM
  4. [CLOSED] Adding custom html attribute
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 30, 2011, 12:25 AM
  5. [CLOSED] Get parent node custom attribute
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 14, 2010, 9:19 PM

Posting Permissions