ExtJS:将 html 表单转换为 ExtJS [英] ExtJS: Convert html form to ExtJS

查看:30
本文介绍了ExtJS:将 html 表单转换为 ExtJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够将 html 表单转换为 ExtJs 表单.我了解到您必须对 applyTo 执行某些操作,但不确定该做什么.

I want to be able to convert a html form to an ExtJs form. I have read that you have to do something with applyTo but wasn't really sure about what to do.

希望有人能给我一些帮助,

I hope someone can provide me with some help,

干杯

推荐答案

如果您想将表单中的每个元素都转换为 ExtJS 元素,Sencha 论坛 已经发布了一个解决方案(我将在这里交叉发布):

If you want to convert every element in a form to an ExtJS element, someone on the Sencha forums has posted a solution (which I will cross-post here):

function convertForm(formId) {
    var frm = new Ext.form.BasicForm(formId);
    //frm.render();

    var fields = frm.getValues()

    for (key in fields) {

        var elem = Ext.get(key);
        if (elem && elem.hasClass('combo-box')) {
            var cb = new Ext.form.ComboBox({
                transform: elem.dom.name,
                typeAhead: true,
                triggerAction: 'all',
                width: elem.getWidth(),
                forceSelection: true
            });
        }
        else 
            if (elem && elem.hasClass('date-picker')) {
                var df = new Ext.form.DateField({
                    format: 'm/d/Y'
                });
                df.applyTo(elem.dom.name);
            }

        if (elem && elem.hasClass('resizeable')) {
            var dwrapped = new Ext.Resizable(elem, {
                wrap: true,
                pinned: true,
                width: 400,
                height: 150,
                minWidth: 200,
                minHeight: 50,
                dynamic: true
            });
        }
    }
}

这篇关于ExtJS:将 html 表单转换为 ExtJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆