JSFiddle - React, Tailwind, and code Playground
by ason5861_cs
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<?php
//include "../config.php";
require_once("../conf/db_conn.php");
?>
<style>
label {
display: inline-block;
width: 5em;
}
// li:nth-child(1) {
// color: blue;
// }
// li:nth-child(2) {
// color: red;
// }
// li:nth-child(3) {
// color: yellow;
// }
// li:nth-child(4) {
// color: purple;
// }
// li:nth-child(5) {
// color: green;
// }
// li.jstree-open > ul {
// color: red;
// display: block;
// }
// li.jstree-open > ul {
// color: red;
// display: block;
// }
// li.jstree-open{
// color: blue;
// display: block;
// }
// li.jstree-open > ul li.jstree-open > ul {
// color: black;
// position: relative;
// left: -18px;
// padding-left: 18px;
// width: 100%;
// }
#category{
font-size:5px;
}
</style>
<br>
<?php
$folderData = mysqli_query($mysql_con,"SELECT * FROM folder_category where status=1");
$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>",
"state" => array("selected" => $selected,"opened"=>$opened)
);
}
?>
<!-- Initialize jsTree -->
<div id="folder_jstree" title="JTM"></div>
<!-- Store folder list in JSON format -->
<textarea style="" id='txt_folderjsondata'><?= json_encode($folders_arr) ?></textarea>
<script...