如果状态为非活动状态,如何避免行内容中的删除线? [英] How to avodi the strike-through in the row content if the status is inactive?

查看:51
本文介绍了如果状态为非活动状态,如何避免行内容中的删除线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果状态为非活动状态,我有一个问题要避免行内容$row['filing_code_refer']成为删除线,我的代码向我展示了下面的输出不能避免$row['filing_code_refer']成为删除线.

I have a problem to avoid the row content $row['filing_code_refer'] become the strike-through if the status is inactive, my coding show me the output below cannot avoid the $row['filing_code_refer'] become the strike-through.

下面是我的编码:

 <?php 
   $folderData = mysqli_query($mysql_con,"SELECT * FROM filing_code_management");
    // $arr_sql5 = db_conn_select($folderData);
    // foreach ($arr_sql5 as $rs_sql5) {
    // $active = $rs_sql5['status'];
// }


   $folders_arr = array();
   while($row = mysqli_fetch_assoc($folderData)){
      $parentid = $row['parentid'];
      if($parentid == '0') $parentid = "#";

      $selected = false;$opened = false;
      if($row['id'] == 2){
         $selected = true;$opened = true;
      }
      $folders_arr[] = array(

         "id" => $row['id'],
         "parent" => $parentid,
         "text" => $row['name'] . ' ' . "<span id='category'>". $row['category']."</span>" . ' ' . "Rujuk Kod" .$row['filing_code_refer'],
         "category" => $row['category'],
         "filing_code_refer" => $row['filing_code_refer'],
         // "status" => $row['status'], // status 0 is inactive, status 1 is active
         "data" => array("status" => $row['status']) ,
         "state" => array("selected" => $selected,"opened"=>$opened) 

      );
   }

   ?> 

 <!-- Initialize jsTree -->
   <div id="folder_jstree" title=""></div>
   <!-- Store folder list in JSON format -->
   <textarea style="" id='txt_folderjsondata'><?= json_encode($folders_arr) ?></textarea>


<script style="text/javascript">
  $(document).ready(function() {
    var folder_jsondata = JSON.parse($('#txt_folderjsondata').val());

    $('#folder_jstree').jstree({
      'core': {
        'data': folder_jsondata,
        'multiple': false
      },
      'plugins': ['sort'],
      'sort': function(a, b) {
        return this.get_text(a).localeCompare(this.get_text(b), 'en', {
          numeric: true
        });
      }
    });

    var getColor = function(i) {
      if (i >= 100 && i <= 199) {
        return "blue";
      } else if (i >= 200 && i <= 299) {
        return "red";
      } else if (i >= 300 && i <= 399) {
        return "yellow";
      } else if (i >= 400 && i <= 499) {
        return "purple";
      } else if (i >= 500 && i <= 599) {
        return "green";
      } else {
        return "#000";
      }
    };



    var colorNodes = function(nodelist) {
        var getStrike = function(status) {
      if (status === "0") {
        return "line-through;";
      }  else {
        return "";
      }
    };
      var tree = $('#folder_jstree').jstree(true);
      nodelist.forEach(function(n) {
        tree.get_node(n.id).a_attr.style = "color:" + getColor(parseInt(n.text.substr(0, 3), 10))+ ";"+"text-decoration:" + getStrike(n.data.status);
        tree.redraw_node(n.id); //Redraw tree
        colorNodes(n.children); //Update leaf nodes
      });
    };

    $('#folder_jstree').bind('load_node.jstree', function(e, data) {
      var tree = $('#folder_jstree').jstree(true);
      colorNodes(tree.get_json());
    });


    $('#folder_jstree').bind('hover_node.jstree', function(e, data) {
      $("#" + data.node.id).attr("title", data.node.original.category);
    });

  });

</script>

这是我正在工作的JSfiddle: https://jsfiddle.net/ason5861_cs/3agdhkqf/3/

This is my working JSfiddle : https://jsfiddle.net/ason5861_cs/3agdhkqf/3/

实际上,如果文件夹名称状态为inactive(0),我希望图片下方的输出可以显示filing_code_refer.如果处于活动状态,则不会显示filing_code_refer内容.希望有人可以指导我如何解决它.谢谢.

Actually, I want the output like below the picture can show filing_code_refer if the folder name status is inactive(0). If active will no show the filing_code_refer content.Hope someone can guide me how to solve it. Thanks.

推荐答案

在HTML 4和XHTML 1中已弃用此元素,而在HTML5中已弃用该元素.如果在语义上适当,即表示已删除的内容,请改用.在所有其他情况下,请使用.

This element is deprecated in HTML 4 and XHTML 1, and obsoleted in HTML5. If semantically appropriate, i.e., if it represents deleted content, use instead. In all other cases use .

这篇关于如果状态为非活动状态,如何避免行内容中的删除线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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