Please can you explain me what I have to do in order not to get all Java script in one line (horizontally), like in attachment. I would like to have possibility to debug where java script lines are like in editor.
Thanks
Printable View
Please can you explain me what I have to do in order not to get all Java script in one line (horizontally), like in attachment. I would like to have possibility to debug where java script lines are like in editor.
Thanks
Hello,
This is the default behavior of resource manager to make transferred data smaller. While this is a hell debugging, it's faster for users to load. Okay, this you already knew. Now, to the point:
Set the resourceManager on your page to format the source. Useful as well -- when you are debugging -- is to set the rest of the scripts formatted as well.
HTML Code:<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" SourceFormatting="true" />
ScriptMode
nicely formats -- and allow your visual studio to actually open -- the dynamic handles without giving you headaches. The ext.axd?v=... handles.
SourceFormatting
makes the actual source of what you've written using Ext.NET shows nicely as equivalent ExtJS-formated code.
I hope this helps you debug your app.
Hello Avenger
Thanks for your support. Unfortunately this did not help. Maybe it's because I am using MVC. I tried also something like this:
but then I got:Code:@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
var X = Html.X();
MvcResourceManager.RegisterGlobalScript(Url.Content("~/Scripts/GridScripts.js"));
ResourceManager.GetInstance().ID = "resourcemanager1";
ResourceManager.GetInstance().ScriptMode = Ext.Net.ScriptMode.Debug;
ResourceManager.GetInstance().SourceFormatting = true;
}
with line 8 in red.Code:Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 6: var X = Html.X();
Line 7: MvcResourceManager.RegisterGlobalScript(Url.Content("~/Scripts/GridScripts.js"));
Line 8: ResourceManager.GetInstance().ID = "resourcemanager1";
Line 9: ResourceManager.GetInstance().ScriptMode = Ext.Net.ScriptMode.Debug;
Line 10: ResourceManager.GetInstance().SourceFormatting = true
The same options you have on markup/code behind should be on razor syntax as well. For instance:
Did you try this?Code:@(Html.X().ResourceManager().ScriptMode(Ext.Net.ScriptMode.Debug).SourceFormatting(true))
I put that line on the beginning of each view and partial view in my project, but still without success :(. Java script still appears in one horizontal line while debugging. Strange enough in some other test projects java script appears normal even without putting this line...
Hmmm then maybe the only option left is if you provide us with a simple view+controller code that reproduces your issue, and then I review it until I see the generated javascript all ungolfed.
You think it is reasonable to ask you for such a sample? (the shorter you make it, the better)
Hmmm it's too much effort for this kind of nuisance. I mean debugging works, only it is hard to follow it since everything is in one line. Maybe when I have more time I will try to make sample, that you can investigate.
Just let us know when you are at it.
For me, sincerely, these settings on the resourceManager made both the linked code and generated javascript be readable. (by breaking lines on generated code).
@Daniil just pointed me, I might have committed a mistake. While what I was focusing was the generated code after you just open the page. What you're looking at is returned code/script from a directMethod or something like it, right? What is the exact situation when you get such unformatted code?