Skip to content

a_attr and li_attr not adding attributes #2809

@rupisaini123

Description

@rupisaini123

I am passing in additional attributes for a and li tag using data-jstree. But these attributes are not added to these elements.
Here is my sample HTML:
`


  • Administration

    • `

      Here is the rendered HTML
      ` <li
      role="none"
      data-jstree='{"selected": true

      ,"disabled": false 
      ,"a_attr": {"title":"Tooltip for Node 1","class":"testttt"}
      

      ,"li_attr": {"title":"Tooltip for Node 1","class":"testttt"}

      }'
      id="Pages.Administration"
      class="jstree-node jstree-open"
      >

      Administration


        <li
        role="none"
        data-jstree='{"selected": true

        ,"disabled": false 
        ,"a_attr": {"title":"Tooltip for Node 1","class":"testttt"}
        

        ,"li_attr": {"title":"Tooltip for Node 1","class":"testttt"}

        }'
        id="Pages.Administration.AuditLogs"
        class="jstree-node jstree-leaf"
        >

        Audit logs



  • `

    Code for initialization
    `var _jsTreeOptions = {
    types: {
    default: {
    icon: 'fa fa-folder text-warning',
    },
    file: {
    icon: 'fa fa-file text-warning',
    },
    },
    checkbox: {
    keep_selected_style: false,
    three_state: false,
    cascade: '',
    },
    search: {
    show_only_matches: true,
    },
    plugins: ['checkbox', 'types', 'search'],
    };

      if (options) {
        if (options.singleSelect && options.singleSelect === true) {
          $.extend(_jsTreeOptions, {
            core: {
              multiple: false,
            },
          });
        }
      }
    
      $tree.jstree(_jsTreeOptions);`
    

    I am not sure what exactly i am missing.

    jstree code.txt

    Thanks in advance

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      No labels
      No labels

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions