Sunday, 15 August 2010

jquery - JSTree fragmentation issue in Rails -


I am trying to create a file explorer in the rail and there is a strange problem with some sort of fragmentation of my jestery . (See image below)

Enter image details here

I 'suspect that there is something in my javascript file with this line, but I'm not quite sure. ( full JS file is below )

  'data': & lt;% = @ folders.to_json.html_safe%>,  < / Pre> 

I doubt this suspicious reason for this code because in another project I got the zeri to create the right way, but I was doing it without any AJAX call.

However, now I am using AJAX calls using a JAG, to create a JUST to answer the server with Javascript, I'm getting this strange fragmentation.

Be able to explain why this is happening?


myView.html.haml

 % a.btn {id: 'open -test-data-directory'} # TreeViewDiv  

application.js

  $ (document) .on (click ',' #Open -test-data-directory ', function () {$ .ajax ({method: "GET", url: "/ fire_ajax", data type: "script"})  

< P> routes.rb

  go '/ fire_ajax', for: 'ajax # go'  

ajax_controller.rb

  def go = folders = directory_ship ("/ home / gefree / document / ruby_workspace / old_learning ruby ​​on rail - Responsive_toile: my_jserb_file} and end  

my_jserb_ file (jquery) Strong> function builds () {return $ ("# tree viewdiv"). Jstree ({'core': {'data': & lt;% = @ Folders.to_json.html_safe %>, // & lt; ----- Suspicious line !!! 'Topics': {'name': 'proton'}}}); } BuildMyJStree (); Actually, I'm not sure of anything in my "suspicious line" that has nothing to do with it. I went ahead and tried to manually create data for the zest and the same view problem occurred in the tree. Please see the code given below:

  function builds gallery () {$ ("# tree view"). Jstree ({'core': {// # 'data': & lt;% = @ Folders.to_json.html_safe%>, // & lt; ----- Suspicious line !!! 'Data': [{'Text': 'Route 1', 'Children': []}, {'Text': 'Route 2', 'Children': [{'text': 'Route 2 child 1'}, {'text ':' Root 2 kid 2 '}}}, {' text ':' root 3 ',' children ': []}],' theme ': {' name ':' proton '}}}); } BuildMyJStree ();  

Enter image details here

No problem sorry everyone was digging through the Chrome debugger and I realized that I have a CSS conflict between dependency is.

One of my dependencies was this style defined. Once I disabled the margin-down property, the problem went away.

 . H-entry ul {margin-down: 20px; List style: Category; Margin-left: 1.5 AM; }  

No comments:

Post a Comment