本文介绍了通过自定义字段描述(javascript)添加的控件所面临的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是字段描述中包含的内容,因此,我可以显示摘要行。

Below is the stuff which is included in field descirption so, i could have summary row appear.

  <script type="text/javascript">
   var table = AJS.$('<table style="margin-left: 130px;">').append(
                            AJS.$('<tr>').append(
"<td  style='border: 0px; width: 90px; margin-left: 1px; font-weight: bold; background-color:  rgb(204, 255, 255);'><div id='customfield_summary_2:input1'>0</div></td>"
                                                ).append(
            "<td  style='border: 0px; width: 90px; margin-left: 1px; font-weight: bold;   background-color: rgb(204, 255, 255);'><div id='customfield_summary_2:input2'>0</div></td>"
                                                        )
                                 );
if(AJS.$("#edit-issue-dialog").length)
{
    AJS.$("#customfield_11278\\:input1").parent().parent().parent().parent().parent().before(table);
}
else
{
 AJS.$("#customfield_11278\\:input1").parent().parent().parent().parent().before(table);
}
</script>

  <script type="text/javascript">
   AJS.$("#customfield_summary_2\\:input1").text(
"$" + (
    parseInt(AJS.$
                 ("#customfield_11278\\:input1").val()
            ) +
    parseInt(AJS.$
                 ("#customfield_11279\\:input1").val()
            ) +
    parseInt(AJS.$
                 ("#customfield_11280\\:input1").val()
            )+
    parseInt(AJS.$
                 ("#customfield_11281\\:input1").val()
            )+
    parseInt(AJS.$
                 ("#customfield_11282\\:input1").val()
            )+
    parseInt(AJS.$
                 ("#customfield_11283\\:input1").val()
            )+
    parseInt(AJS.$
                 ("#customfield_11284\\:input1").val()
            )+
    parseInt(AJS.$
                 ("#customfield_11285\\:input1").val()
            )
    ).toString()
     );
 </script>

几个问题:
1.获取重复的摘要行(通过jquery添加的字段)当关闭编辑屏幕时。应该如何解决。
2.此摘要自定义字段显示在视图屏幕和编辑屏幕上。现在,在查看屏幕中,当我对其他字段进行内联编辑并保存时,此摘要自定义字段(通过客户端javascript显示)消失,需要刷新屏幕,然后在它出现后更新值。

couple of issues:1. get duplicate summary row (field that added through jquery) when close the edit screen. How it should be resolve.2. This summary custom field which appears on view screen and edit screen. Now, In View screen, when i do inline edit for other field and save then this summary custom field (appear through client side javascript) gets disappear and need to refresh screen then after it gets appear and value gets updated.

请在上述查询中告诉我。
谢谢

please let me know on above queries.Thank You

推荐答案

找到了解决方案,如下所示:@Kuf在注释中。

Found solution as follow @Kuf in comment How to develop custom field (plugin) having multiple input fields.


  1. 删除重复的-每次-在追加之前删除表,并将所有内容保留在setInterval中,以解决问题。

  1. remove duplicated - have every time - remove table before appending and kept all in setInterval which resolve the issue.


setInterval(function()

setInterval(function()


if(AJS。$(#edit-issue-dialog)。length )
{

AJS。$(#customfield_11278\:input1)。parent()。parent()。parent()。parent()。parent()。before(table) );
}
其他
{
AJS。$(#customfield_11278\:input1)。parent()。parent()。parent()。parent() .before(table);
},2000)

if(AJS.$("#edit-issue-dialog").length){
AJS.$("#customfield_11278\:input1").parent().parent().parent().parent().parent().before(table);}else{ AJS.$("#customfield_11278\:input1").parent().parent().parent().parent().before(table);},2000)

刷新内联编辑:
使用setInterval如下:

refresh inline editing:ave used setInterval as below:

setInterval(function(){

setInterval(function() {

AJS。$(#customfield_summary_2\:input1)。text(
$ +(
parseInt(AJS。$
(#customfield_11278\:input1)。val()
)+
parseInt(AJS。$
(#customfield_11279 \:input1)。val()
)+
parseInt(AJS。$
(#customfield_11280\:input1)。val()
)+
parseInt(AJS。$
(#customfield_11281\:input1)。val()
)+
parseInt(AJS。$
(#customfield_11282\ \:input1)。val()
)+
parseInt(AJS。$
(#customfield_11283\:input1)。val()
)+
parseInt(AJS。$
(#customfield_11284\:input1)。val()
)+
parseInt(AJS。$
(#customfield_11285\ :input1)。val()

).toString()
);, 2000年);

AJS.$("#customfield_summary_2\:input1").text( "$" + ( parseInt(AJS.$ ("#customfield_11278\:input1").val() ) + parseInt(AJS.$ ("#customfield_11279\:input1").val() ) + parseInt(AJS.$ ("#customfield_11280\:input1").val() )+ parseInt(AJS.$ ("#customfield_11281\:input1").val() )+ parseInt(AJS.$ ("#customfield_11282\:input1").val() )+ parseInt(AJS.$ ("#customfield_11283\:input1").val() )+ parseInt(AJS.$ ("#customfield_11284\:input1").val() )+ parseInt(AJS.$ ("#customfield_11285\:input1").val() ) ).toString() );, 2000);

谢谢

这篇关于通过自定义字段描述(javascript)添加的控件所面临的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 20:51