从数据库列类型和大小动态构造工具提示 [英] Dynamically construct tooltip from database column type and size

查看:92
本文介绍了从数据库列类型和大小动态构造工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究angularjs,entity-framework和WebAPI。我想动态地显示输入元素的工具提示。工具提示必须基于DB列类型和大小构建。我想使用查询获取列信息



从INFORMATION_SCHEMA.columns中选择COLUMN_NAME,CHARACTER_MAXIMUM_LENGTH,DATA_TYPE TABLE_NAME ='Tabletest'



但这会为每个页面添加一个额外的API调用。这是显示工具提示的正确方法吗?请建议我正确的方法来实现这一点。



目前我正在使用Directive来显示这样的工具提示

 app.directive('  tooltip' function (){
return {
restrict:' A'
链接: function (范围,元素,attrs){
$(元素) .hover( function (){
// on mouseenter
$(元素).tooltip(' show') ;
}, function (){
// 在mous上eleave
$(元素).tooltip(' hide');
});
}
};
});







和HTMl as



< input type =textname =Mytextclass =form-controltitle =名称最多60个字符required =requiredtooltip>



我在禁用按钮工具提示时遇到的另一个问题未显示。为此我找到了解决方案,如



Angular:关于禁用输入的工具提示 - JSFiddle [ ^ ]



我想使用相同的指令用于所有控件。我怎么能实现这一点。在此先感谢。

解决方案

(元素).hover( function (){
< span class =code-comment> // on mouseenter


(element).tooltip(' show');
}, function (){
// on mouseleave


< blockquote>(element).tooltip(' hide');
});
}
};
});







和HTMl as



< input type =textname =Mytextclass =form-controltitle =名称最多60个字符required =requiredtooltip>



我在禁用按钮工具提示时遇到的另一个问题未显示。为此我找到了解决方案,如



Angular:关于禁用输入的工具提示 - JSFiddle [ ^ ]



我想使用相同的指令用于所有控件。我怎么能实现这一点。提前致谢。


I am working on angularjs, entity-framework and WebAPI .I want to show tool-tip for input elements dynamically. Tooltip has to be constructed on the basis of DB column type and size.I thought of fetching column information using query

select COLUMN_NAME,CHARACTER_MAXIMUM_LENGTH,DATA_TYPE from INFORMATION_SCHEMA.columns where TABLE_NAME ='Tabletest'

But this will add one extra API call for each page. Is this right way of showing tooltip. Please suggest me right approach to achieve this.

Currently I am using Directive to show tooltip like this

app.directive('tooltip', function () {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            $(element).hover(function () {
                // on mouseenter
                $(element).tooltip('show');
            }, function () {
                // on mouseleave
                $(element).tooltip('hide');
            });
        }
    };
});




and HTMl as

<input type="text" name="Mytext" class="form-control" title="Name should be of max 60 characters" required="required" tooltip >

One more issue I am facing while I disable the buttons tooltip is not shown. for this I found the solution as in

Angular: Tooltip on disabled input - JSFiddle[^]

I wanted to use same Directive to use for all controls. how can I achieve that. Thanks in advance.

解决方案

(element).hover(function () { // on mouseenter


(element).tooltip('show'); }, function () { // on mouseleave


(element).tooltip('hide'); }); } }; });




and HTMl as

<input type="text" name="Mytext" class="form-control" title="Name should be of max 60 characters" required="required" tooltip >

One more issue I am facing while I disable the buttons tooltip is not shown. for this I found the solution as in

Angular: Tooltip on disabled input - JSFiddle[^]

I wanted to use same Directive to use for all controls. how can I achieve that. Thanks in advance.


这篇关于从数据库列类型和大小动态构造工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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