想要在文本字段旁边的占位符图标中呈现客户名称的首字母缩写

Wanting to render the Initials of a customer name in a placeholder icon next to the textfield

提问人:Aryan Mehta 提问时间:11/3/2023 更新时间:11/3/2023 访问量:25

问:

'**我将给出一个完整的场景,我来到一个页面,它有一个搜索图标,当我单击它时,会生成一个客户端列表,在选择其中一个客户端后,文本字段正在填充,但占位符图标没有被填充客户端的初始。

比方说,我从菜单中选择 INNOCHRIS SFC,INNOCHRIS SFC 填充在文本字段中,但它没有反映在首字母为“IS”的占位符图标上。

另外,当我转到下一步时,即下一页,并再次返回此步骤(单击后),我看到启动显示为“IS”和“INNOCHRIS SFC”。

因此,所需的状态是上面提到的状态,在选择客户端名称时,该名称是 INNOCHRIS SFC 。IS 应一起显示。上图是预期的步骤。我尝试调试,发现c#和EXT JS的方法很少。

`Here is the C# Code : 
           #region poponField
           string poponFieldIcon = activateUserDisplay ? string.Empty : "popon-info-button";
           poponField.fieldLabel = String.Empty;
           poponField.flex = 1;
           poponField.cls = "axe-basic-field";
           poponField.ACPPoponFieldEntry = XmlUtility.GetAttributeValue(currentFieldXElement, Constant.xmlAttribute.searchentry);
           poponField.ACPParentItemName = itemName;
           poponField.ACPPoponDisplayTitle = XmlUtility.GetDisplayAttributeFromCultureTag(currentFieldXElement, culture.language);
           poponField.ACPItemID = itemID;
           poponField.padding = "8 0 8 0";
           poponField.listeners = (ComboBoxListeners)AddListenersToComponent(poponField.listeners, Helper.GetInstance().GenerateGenericListener("poponfieldInfoFeature"
               , Constant.extJsEventPameters["fieldChange"], null, false), "change", new ComboBoxListeners());
           poponField.listeners = (ComboBoxListeners)AddListenersToComponent(poponField.listeners, Helper.GetInstance().GenerateGenericListener("clearInvalideValueForPoponFiedlOnBlur"
             , Constant.extJsEventPameters["componentBlur"], null, false), "blur", new ComboBoxListeners());
           poponField.ACPUserDisplay = activateUserDisplay;
           fieldcontainer.items.Add(poponField);
           #endregion`
```
#endregion  /// This has a method which contains the references to the javascript code `poponfieldInfoFeature which is Javascript ref`

This method looks like this and calls another reference SetPopFieldCustomDisplay

var poponfieldInfoFeature = function (field, oldValue, newValue, opt) {
    var poponfield = field.up('fieldcontainer');
    var infoButton = poponfield.down('button[itemId=info]');
    if (infoButton) {
        var fieldValue = field.getValue();
        var record = field.findRecordByValue(fieldValue);
        if (record && record.get('REF')) {
            if (acpV9 && field.ACPUserDisplay) SetPoponFieldCustomDisplay(infoButton, null, newValue)
            infoButton.setDisabled(false);
        } else {
            if (acpV9 && field.ACPUserDisplay) infoButton.setText('');
            infoButton.setDisabled(true);
        }
    }
}
////// POPFIELD METHOD ///////

var SetPoponFieldCustomDisplay = function (currentbtn, ept, fieldValue) {
    var len = currentbtn.up().down().xtype == 'poponfield' ? currentbtn.up().down().getStore().data.items.length : 0;
    var poponText = '';
    if (currentbtn.up().down().xtype != 'poponfield' || len != 0) {
        switch (currentbtn.up().down().xtype) {
            case 'poponfield':
                poponText = currentbtn.up().down().getStore().data.items[0].data.TEXT;
                break;
            case 'combobox':
                if (fieldValue != null && fieldValue != '' && currentbtn.up().down().findRecordByValue(fieldValue).data != null) {
                    poponText = currentbtn.up().down().findRecordByValue(fieldValue).data.TEXT;
                } else {
                    poponText = currentbtn.up().down().getValue();
                }
                break;
            default:
                poponText = currentbtn.up().down().getValue();
                break;
        }
    }

    if (poponText != '' && poponText != null) {
        var matches = poponText.match(/\b(\w)/g);
        var acronym = matches.join('');
        acronym = acronym.length > 2 ? acronym.charAt(0) + acronym.charAt(acronym.length - 1) : acronym
        currentbtn.setText(acronym.toLowerCase());
    }
    else
        currentbtn.setText('');
}
**`

So overall here is the flow ---- EXTJSGenerator.cs has several methods to reference the javascript variables , one of which I suspect the poponfieldFeature which in turn references to SetPoponFieldCustomDisplay.
I tried to manipulate the functions SetPoponFieldCustomDisplay  and poponfieldFeature  functions but no lick , could not understand why "Initals are not displayed"" ..  please help me `**
C# asp.net-mvc extjs

评论

0赞 D A 11/3/2023
如果您无法在 StackBlitz 或任何其他在线工具中隔离问题或为我们创建一个完整的功能示例,恐怕我们无法帮助您(或至少是我)
0赞 Jeanot Zubler 11/3/2023
花点时间阅读帮助中心中的编辑帮助。Stack Overflow 上的格式与其他站点上的格式不同。你的帖子看起来越好,其他人就越容易阅读和理解它。

答: 暂无答案