Reliably Broken » Blog Archive » Encoding lists in Django for jQuery:: I need a matching rule in urls.py to direct requests to the JSON view: urlpatterns = patterns('myproject.myapp.views', url(r'^find_employees/$', http://reliablybroken.com/b/2008/06/encoding-lists-in-django-for-jquery/HOME | I have configured and loaded jsonView object "jsnView", and one item in them are selected. Then i process this:
var data = jsnView.getNodeData(jsnView.getSelectedNodes());
for (var i=0; i < data.length; i++) {
result.push(data[i].uid); Setting up a test-case to show the leak:: isolate a scenario as simple as possible that should not leak and . I think that this bug must be fixed: while it is unlikely that 30 grids will be http://membres.lycos.fr/yhv/grid_leak_report.htmlHOME |
}
Where data are simple array of a some property of selected items (in this case - one item) in jsnView view. But data.length == 1!
By JS notation if array have one element his length == 0 or i'm wrong?
hmm... but in this case I have array with two elements, second is undef :(
Now your array length is 2? I think you need to use firebug and debug your code and look at what's going on.
I think that it's not good idea to do something with the array that changes it's length in such a loop. The better would be: Coffee Powered » Blog Archive » Powerful, easy, DRY, multi-format :: Sep 27, 2008 For example, if you have a /foo/bar.json view that would render the following JSON: "{\"foo\":\"bar\"}" http://www.coffeepowered.net/2008/09/27/powerful-easy-dry-multi-format-rest-apis/HOME |
var len = arr.length;
for(var i = 0; i < len; i++) {
// do something with arr
}
If it has 1 item, it's length is 1.
Nobody understands...any help please?
50 points for someone willing to do this!!!!!!!!!!?
|