我们如何显示标签栏上的文本 [英] How we can display text from tab bar

查看:63
本文介绍了我们如何显示标签栏上的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Helo Freinds

我已经创建了选项卡栏,当我们单击选项卡栏时,必须显示视图页面.在该视图页面中,它包含有关该选项卡栏的信息

我的查看页面代码

Helo Freinds

I had created tab bar When we click tab bar the view page has to displayed.In that view page it contains information about that tab bar

my view page code

var tabbars = [];

    tabbars[0] = initTabbar("b_tabbar", "right", "left");
    tabbars[1] = initTabbar("a_tabbar", "top", "left");
    tabbars[0].setSkin('dhx_skyblue');
    tabbars[1].setSkin('dhx_skyblue');

    tabbars[0].setImagePath("../../codebase/imgs/");
    tabbars[1].setImagePath("../../codebase/imgs/");
    var formData;
    var myForm = new dhtmlXForm("form_container", formData);
    dhxWins = new dhtmlXWindows();
    dhxWins.setImagePath("dhtmlxWindows/codebase/imgs/");
    var popupWindow = dhxWins.createWindow("b_tabbar", 0, 0, 250, 250);
    popupWindow.hide();
    formData = [{
        type: "input",
        label: "Enter Tab",
        name: "Name",
        value: ""
    },
    {
        type: "button",
        name: "Save",
        value: "Save",
        command: "Save"
    }, {
        type: "button",
        name: "Cancel",
        value: "Cancel"

    }
    ];
    var myForm = popupWindow.attachForm(formData);

    var url = '/Home/Database'
    $.ajax({ type: "GET",
        url: url,

        dataType: "json",
        error: function (xhr, status, error) {
            alert(error);
        },
        success: function (json) {
            var c = 1;
            var d = 0;
            for (i = 0; i <= 3; i++) {
                c++;

                d++;
                tabbars[1].addTab("a" + d, json[i].Tabname, "60px");
                tabbars[1].setContentHTML("a1", "<b>HTML</b>");
                if (c == 5) {

                    tabbars[1].addTab("a" + c, "newtab", "60px");

                    var lastTab = "a" + c;

                    tabbars[1].attachEvent("onSelect", function (id, prevId) {

                        if (id == lastTab) {
                            popupWindow.show();
                            popupWindow.center();
                            popupWindow.button("close").disable();
                            myForm.setItemFocus("Name");

                        }
                        return true;
                    });

                    var c = 6;
                    myForm.attachEvent("onButtonClick", function (name, command) {
                        if (name == "Save") {

                            var value = myForm.getItemValue("Name");
                            //            lastTab = "a" + c;
                            var index = tabbars[1]._rows[0].tabCount - 1;

                            tabbars[1].addTab("a" + c, value, "60px", index);
                            tabbars[1].setTabActive("a" + c);

                            c++;

                            popupWindow.hide();
                            tabbars[1].setContentHTML("a" + c, "a <br/> b");
                        }
                    });
                    myForm.attachEvent("onButtonClick", function (name, command) {


                        if (name == "Cancel") {

                            popupWindow.hide();
                            tabbars[1].setTabActive("a4");


                        }
                    });
                }

                myForm.attachEvent("onButtonClick", function (name, command) {

                    if (name == "Save" && command == "Save") {

                        $.ajax({

                            url: "/Home/Save",

                            data: JSON.stringify({

                                name: myForm.getItemValue("Name")
                            }),
                            cache: false,
                            dataType: "json",
                            success: function (str) {
                                alert(str.st);

                            },
                            type: 'POST',
                            contentType: 'application/json; charset=utf-8'
                        });
                    }
                });
            }
        }
    });


    $.getJSON('/Home/AddTab', "", function (data) {
        tabbars[0].setHrefMode("ajax-html");
        tabbars[0].addTab("b1", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab1 + "</div>", "60px");
        tabbars[0].addTab("b2", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab2 + "</div>", "60px");
        tabbars[0].addTab("b3", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab3 + "</div>", "60px");
        tabbars[0].setContentHref("b1", "../../Home/About");
    });




在此代码中,将视图页面引用添加到选项卡栏的位置.




In this code where to add view page reference to the tab bar

推荐答案

.ajax({type:" 获取", 网址:url, dataType:" , 错误:功能(xhr,状态,错误){ 警报(错误); }, 成功:函数(json){ var c = 1 ; var d = 0 ; for (i = 0 ; i >< = 3 ; i ++){ c ++; d ++; tabbars [ 1 ].addTab(" + d,json [i] .Tabname," ); tabbars [ 1 ].setContentHTML(" " ); 如果(c == 5 ){ tabbars [ 1 ].addTab(" + c," " 60px"); var lastTab = " + c ; tabbars [ 1 ].attachEvent(" ,函数(id,prevId){ 如果(id == lastTab){ popupWindow.show(); popupWindow.center(); popupWindow.button(" ).disable(); myForm.setItemFocus(" ); } 返回 ; }); var c = 6 ; myForm.attachEvent(" ,函数(名称,命令){ 如果(名称== " ){ var = myForm.getItemValue(" 名称"); // lastTab ="a" + c; var 索引=标签栏[ 1 ] ._ rows [ 0 ].tabCount- 1 ; tabbars [ 1 ].addTab(" + c," ,index); tabbars [ 1 ].setTabActive(" + c); c ++; popupWindow.hide(); tabbars [ 1 ].setContentHTML(" + c," ); } }); myForm.attachEvent(" ,函数(名称,命令){ 如果(名称== " ){ popupWindow.hide(); tabbars [ 1 ].setTabActive(" ); } }); } myForm.attachEvent(" ,函数(名称,命令){ 如果(名称== " &&命令== " ){
.ajax({ type: "GET", url: url, dataType: "json", error: function (xhr, status, error) { alert(error); }, success: function (json) { var c = 1; var d = 0; for (i = 0; i <= 3; i++) { c++; d++; tabbars[1].addTab("a" + d, json[i].Tabname, "60px"); tabbars[1].setContentHTML("a1", "<b>HTML</b>"); if (c == 5) { tabbars[1].addTab("a" + c, "newtab", "60px"); var lastTab = "a" + c; tabbars[1].attachEvent("onSelect", function (id, prevId) { if (id == lastTab) { popupWindow.show(); popupWindow.center(); popupWindow.button("close").disable(); myForm.setItemFocus("Name"); } return true; }); var c = 6; myForm.attachEvent("onButtonClick", function (name, command) { if (name == "Save") { var value = myForm.getItemValue("Name"); // lastTab = "a" + c; var index = tabbars[1]._rows[0].tabCount - 1; tabbars[1].addTab("a" + c, value, "60px", index); tabbars[1].setTabActive("a" + c); c++; popupWindow.hide(); tabbars[1].setContentHTML("a" + c, "a <br/> b"); } }); myForm.attachEvent("onButtonClick", function (name, command) { if (name == "Cancel") { popupWindow.hide(); tabbars[1].setTabActive("a4"); } }); } myForm.attachEvent("onButtonClick", function (name, command) { if (name == "Save" && command == "Save") {


.ajax({ url:" , 数据:JSON.stringify({ 名称:myForm.getItemValue(" ) }), 缓存: false , dataType:" , 成功:功能(str){ 警报(str.st); }, 类型:' POST', contentType:' application/json; charset = utf-8' }); } }); } } });
.ajax({ url: "/Home/Save", data: JSON.stringify({ name: myForm.getItemValue("Name") }), cache: false, dataType: "json", success: function (str) { alert(str.st); }, type: 'POST', contentType: 'application/json; charset=utf-8' }); } }); } } });


.getJSON(' /Home/AddTab'" ,函数(数据){ tabbars [ 0 ].setHrefMode(" ); tabbars [ 0 ].addTab(" " +(isIE8? ie_filter": ")+ '>" +数据.Tab1+ " " 60像素"); tabbars [ 0 ].addTab(" " +(isIE8? ie_filter": ")+ '>" + data.Tab2 + " " 60像素"); tabbars [ 0 ].addTab(" " +(isIE8? ie_filter": ")+ '>" +数据.Tab3+ " " 60像素"); tabbars [ 0 ].setContentHref(" " ); });
.getJSON('/Home/AddTab', "", function (data) { tabbars[0].setHrefMode("ajax-html"); tabbars[0].addTab("b1", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab1 + "</div>", "60px"); tabbars[0].addTab("b2", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab2 + "</div>", "60px"); tabbars[0].addTab("b3", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab3 + "</div>", "60px"); tabbars[0].setContentHref("b1", "../../Home/About"); });




在此代码中,将视图页面引用添加到选项卡栏的位置




In this code where to add view page reference to the tab bar


这篇关于我们如何显示标签栏上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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