PDA

View Full Version : Write Ext code in C# with ExtJS/ASP.NET/Script#



Teflon
13 Sep 2007, 6:51 AM
I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# (http://www.nikhilk.net/ScriptSharpIntro.aspx) I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier.

Since the entire API is generated, I haven't been able to check every piece of code to make sure nothing is missing, but from what I can tell all of it should be there. The only thing that doesn't work and I have to spend some time to figure out is the methods on Function objects such as createDelegate, defer, etc. Script# includes a createDelegate method but not a defer method. Another feature I want to get done is to create types for each classes constructor config objects so you can get intellisense on the config parameter.

Here is a demo page I put online, this was written entirely in c# code.
It's just the Products in the Northwind DB (Note: This app still uses Ext 1.1.1, I'll update it one day)
http://ext.ordereze.net/scriptsharp/products.aspx

Here's a link to download the complete demo project
http://extsharp.googlecode.com
- The only requirement to run this project locally is to download and install Script# from here (http://projects.nikhilk.net/Projects/ScriptSharp.aspx) and VS2005 of course

And here's the source code for the javascript parser that creates the Ext API
http://extsharp.googlecode.com

UPDATE - 9/14/07
A few things to be aware of when working with this api

Since C#/Script# does not allow for classes to be named the same as namespaces, I had to rename a few classes. They are Ext, Toolbar, DomHelper, UpdateManager, SplitBar. These classes have been renamed to {name}Class where {name} is the name of the original class (i.e. Ext becomes ExtClass in Script#).
In addition to that, the first thing you need to do before you use any Ext code is run the statement below. This method just tells the browser that the class Ext.ExtClass points to the Ext class

ScriptSharpAdapter.init();
I kept running into a problem where Script# wouldn't compile the code and the reason always was that I was accessing classes using the fully qualified name. (i.e. new Ext.form.TextField()) all you need to do to fix this is to add a using statement for the namespace (using Ext.form;) and then changed the code to be (new TextField())


UPDATE - 9/16/07
I've put all source code and downloads on the GoogleCode project website
http://extsharp.googlecode.com
I'll be making updates to the svn repository over there
The change log can be viewed there as well
http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt

UPDATE - 10/3/07
This API has been converted to work with the ExtJS 2.0 alpha release. I want to create some samples using it before packaging it up for a release though. Expect an update within the next few days.

UPDATE - 12/5/07
Updated ExtSharp to parse ExtJS v2.0 Final. Zipped up the parser and the samples.

Intellisense
http://extsharp.googlecode.com/svn/trunk/Images/ext_intellisense.png

Method Signatures with param info
http://extsharp.googlecode.com/svn/trunk/Images/ext_method_sig.png

Method Overloads for varying params
http://extsharp.googlecode.com/svn/trunk/Images/ext_type_overloads.png

Method Overloads for unlimited param functions
I currently have max 15 overloads, but more can be created by just changing a number in the converter project
http://extsharp.googlecode.com/svn/trunk/Images/ext_many_overloads.png

Compile-time error checking
http://extsharp.googlecode.com/svn/trunk/Images/ext_compile_time_errors.png

Events list with usage info
http://extsharp.googlecode.com/svn/trunk/Images/ext_event_list.png

Delegates for all events
http://extsharp.googlecode.com/svn/trunk/Images/ext_anon_delegates.png

Intellisense for config options
http://extsharp.googlecode.com/svn/trunk/Images/ext_config_intellisense.png

harley.333
13 Sep 2007, 7:46 AM
Awesome - please keep up posted on your progress!

mdissel
13 Sep 2007, 7:50 AM
Really great initiative!! If you need any help, just let us know! and keep us posted on updates....

Thanks

Marco

yaip
13 Sep 2007, 10:20 AM
Script# seems to be for C# developer only. Anything for VB guys?

Teflon
13 Sep 2007, 10:23 AM
Yeah Script# is only C#, there isn't anything for VB as far as I know.

J.C. Bize
13 Sep 2007, 10:46 AM
Looks really promising, looking forward to your progress

mdissel
13 Sep 2007, 12:57 PM
I started to play with this and got it compiled... It seems you're using a older version of script# (0.4.2 is latest version), but after changing the references all works fine..

It seems that the SP "GetProductsPagedAndSorted" is missing in the database..

(it seems that resharper doesn't handle the checkbox "do not reference mscorlib.dll" ...:(

Thanks

Marco

Teflon
13 Sep 2007, 1:37 PM
1. I upgraded to Script# v0.4.2 and fixed the references in the zip file above

2. I verified that the sproc "GetProductsPagedAndSorted" is in the db. Here it is if you don't want to download the whole thing again:


CREATE PROCEDURE dbo.GetProductsPagedAndSorted
(
@sortExpression nvarchar(100),
@startRowIndex int,
@maximumRows int
)
AS

-- Make sure a @sortExpression is specified
IF LEN(@sortExpression) = 0
SET @sortExpression = 'ProductID'

-- Issue query
DECLARE @sql nvarchar(4000)
SET @sql = 'SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, CategoryName, SupplierName
FROM (SELECT ProductID, ProductName, p.SupplierID, p.CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued,
c.CategoryName, s.CompanyName AS SupplierName,
ROW_NUMBER() OVER (ORDER BY ' + @sortExpression + ') AS RowRank
FROM Products AS p
INNER JOIN Categories AS c ON
c.CategoryID = p.CategoryID
INNER JOIN Suppliers AS s ON
s.SupplierID = p.SupplierID) AS ProductsWithRowNumbers
WHERE RowRank > ' + CONVERT(nvarchar(10), @startRowIndex) +
' AND RowRank <= (' + CONVERT(nvarchar(10), @startRowIndex) + ' + '
+ CONVERT(nvarchar(10), @maximumRows) + ')'

-- Execute the SQL query
EXEC sp_executesql @sql


3. Yes, Resharper doesn't play nice with Script#. I've learned to ignore the "Anbiguous reference" error.

Thanks so much for your comments. I'm glad I'm not the only person who has an interest in this.

harley.333
13 Sep 2007, 4:18 PM
I remember seeing Script# about a month ago and thinking it was pretty fantastic. But the very next day, I saw a blog about Microsoft's DLR (Dynamic Language Runtime). Which promises to make techniques like Script# a thing of the past.

But honestly Teflon, I'm very happy you took the initiative, and I'm going to give your code a try. I find JavaScript just as easy to write as C# or VB.Net, but having a compiler check for typos and type safety makes my job that much easier.

Again, thanks a ton!

rodiniz
14 Sep 2007, 4:48 AM
Nice job.. I thought about doing this, but its a lot of C# code to write
Well done.

Teflon
14 Sep 2007, 7:14 AM
Nice job.. I thought about doing this, but its a lot of C# code to write
Well done.

Indeed, there is a lot of C# code to write but its pretty much the same amount of code you would write if you were doing it in pure javascript. My intention when working on this was not to decrease the amount of code I need to write, but to make writing that code a lot easier.

The reason I created this project was because I personally find javascript code fairly difficult to manage on a large project. If I write a bunch of javascript code and I want to refactor portions of it out into separate classes, I just don't feel safe moving the code around. Now, I can use Visual Studio (Resharper) to safely do the refactoring for me and I'll know if something is broken at compile time. I know that some may argue that this concern stems from my lack of knowledge of the javascript programming language, and I would agree. But I don't see any harm in making things a bit easier for myself any sharing it with others.

rodiniz
14 Sep 2007, 10:19 AM
What I was meaning its that to wrap ext with script# you had to write a lot of C # code..
The people that will use your project have to write about the same amount of code that they would be writing in javascript.

nkohari
14 Sep 2007, 11:30 AM
Amazing. Great work! I just started a new project using C# and ExtJS a couple weeks ago. I wish this had come out then, but I'll still be moving towards it eventually. :)

FritFrut
14 Sep 2007, 11:57 AM
This is great! Thanks a lot. I didn't look much into API converter, but a couple of quick questions:
Is it possible to generate API for some of my own stuff (mostly Interceptors and changing prototypes), and some extensions, and, if it doesn't work, can I mix generated JavaScript with some hand-written additions?

Thanks in advance, Tom

Brendan Carroll
14 Sep 2007, 12:42 PM
Yes very well done indeed. Will play with it over the weekend. Looks quite promising.

Teflon
14 Sep 2007, 2:22 PM
What I was meaning its that to wrap ext with script# you had to write a lot of C # code..
The people that will use your project have to write about the same amount of code that they would be writing in javascript.
Yeah, this is exactly why I had to figure out a way to auto-generate the C# code


This is great! Thanks a lot. I didn't look much into API converter, but a couple of quick questions:
Is it possible to generate API for some of my own stuff (mostly Interceptors and changing prototypes), and some extensions, and, if it doesn't work, can I mix generated JavaScript with some hand-written additions?

Thanks in advance, Tom
Yes, you can have the converter generate stubs for your code. All you need to do is document your javascript the same way ExtJS source code is documented and place the js files in the folder that the converter looks in. When it reads your js files, the converter will create the C# class, method, and property stubs based on the doc comments in your code.

Teflon
14 Sep 2007, 2:25 PM
I have updated the original post to state a few things to be aware of when working in Script#.

Also, I am thinking of creating a codeplex project for this so others can contribute/fix things. Anyone out there interested?

mdissel
15 Sep 2007, 12:45 AM
Also, I am thinking of creating a codeplex project for this so others can contribute/fix things. Anyone out there interested?

Good idea!! But i prefer something with svn access, like SF or googlecode.

Thanks

Marco

rbudisa
15 Sep 2007, 5:13 AM
Very useful. Thanks for sharing.

rbudisa
15 Sep 2007, 5:30 AM
I just downloaded the solution zip "ExtJsSharpTest.zip" and noticed after trying to compile that the project file is missing for the "PageScripts" code.

Regards,
Ron

Teflon
15 Sep 2007, 7:05 AM
Good idea!! But i prefer something with svn access, like SF or googlecode.

Thanks

Marco

Ok, I'll setup something on GoogleCode ...


I just downloaded the solution zip "ExtJsSharpTest.zip" and noticed after trying to compile that the project file is missing for the "PageScripts" code.

Regards,
Ron
I just downloaded the zip file and PageScripts.csproj is in the PageScripts folder

Teflon
15 Sep 2007, 11:57 AM
I have setup this project on Google Code. The url is http://extsharp.googlecode.com

Here are some of the changes I've made today. There will probably be more coming today and tomorrow.

Cleaned up the converter code a bit
removed commented code
refactored methods from ExtClass to where they should be
made the ScriptSharpAdapter.init() code auto-generated so that this code is complete
changed the methods with unlimited arguments from having up to 15 overloads to using the "params" modifier on the single argument
added the Script# [IgnoreNamespace] attribute on classes that have no namespace (i.e. Ext)


if anyone wants access to commit code, just let me know your google username and I'll add you.

mdissel
16 Sep 2007, 3:21 AM
Svn is up and running.. Nice idea to rebuild the demo site, maybe the ExtSSApiConverter can be enhanced to do this as well..

Are you doing any manual correction after ExtSSApiConverter has run?

Thanks
Marco

Teflon
16 Sep 2007, 6:34 AM
Svn is up and running.. Nice idea to rebuild the demo site, maybe the ExtSSApiConverter can be enhanced to do this as well..

Are you doing any manual correction after ExtSSApiConverter has run?

Thanks
Marco

No I'm not doing any manual corrections. What I did to add any additional code that doesn't get recognized by the converter is create a text file in the MoreCode folder. Then I add a quick line in the SourceSonverter.HasMissingCode() method. When the converter is creating the *.cs files, it will check if there is any additional code to manually add to the class. If so, it will just append the code from the text file into the class definition. Take a look in the SourceConverter class at the "HasMissingCode" and "GetMissingCode" methods. The only time this is really necessary, is when code from one class gets applied to another class using Ext.apply(). For example, in Fx.js, all of the methods on the Fx class gets applied to the Element class. So to make these methods available in the API, I just copy all of the generated methods from the Fx.cs file and paste them into Element.txt in the MoreCode folder and add a line in the SourceSonverter.HasMissingCode() method.

mdissel
16 Sep 2007, 7:36 AM
Anyone tried to convert Ext 2.0 yet?

ps. the sourceconvertor has static paths for input and output.

mdissel
16 Sep 2007, 1:20 PM
I see some minor bugs in the Ext.form.Textfield class.. Most of the properties are defined as object, but the correct type is speficied in the doc.

And one other minor comment. Most of the docs contain an empty line with
/// <summary>
/// /**


Thanks
Marco

ksachdeva
16 Sep 2007, 4:34 PM
It's a great work specially idea of writing the parser to generate necessary classes. I was wondering if Script# also provides some sort of unit test (NUnit) and hosted mode support etc as GWT does. For me these 2 would be the reasons to switch to develop in C#.

Thanks
Kapil

mdissel
17 Sep 2007, 1:38 AM
Maybe you should remove the generated code for ExtJsAPI from the svn, because after each conversion the code will be updated. With some batch file we will be able to create the code (if needed).

ps. did you have a look at the Ext.form.TextField property types? the properties are declared as object, instead of the correct type.

Thanks

Marco

sjf
17 Sep 2007, 2:40 AM
Can anyone point me to another location where I can download Script#

cant get http://projects.nikhilk.net/Projects/ScriptSharp.aspx to work.

Cheers

Steve

sonkey
17 Sep 2007, 2:44 AM
There is any one sharing the ScriptSharp.zip file to me? I cann't download it from the offical url : http://projects.nikhilk.net/Binaries/ScriptSharp.zip.
My e-mail is sonkey@163.com.

Thanks.

Teflon
17 Sep 2007, 6:04 AM
I uploaded the installer and manual of Script# v4.2.0 to the GoogleCode project

http://code.google.com/p/extsharp/downloads/list

Teflon
17 Sep 2007, 7:27 AM
Maybe you should remove the generated code for ExtJsAPI from the svn, because after each conversion the code will be updated. With some batch file we will be able to create the code (if needed).

ps. did you have a look at the Ext.form.TextField property types? the properties are declared as object, instead of the correct type.

Thanks

Marco

That's a good idea about removing the generated code, I'll see what I can do.

I updated the converter code to handle those properties. It's now in the API.

sonkey
17 Sep 2007, 7:39 AM
Hi, Teflon:
When I bulid my new project for the scripts, AssemblyInfo.cs file cann't pass the compiling. The error is :
Type “System.Reflection.AssemblyFileVersionAttribute” exist in “e:\Mine\Framework\Libs\sscorlib.dll”and “c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll”

But I never add the mscorlib.dll to my project, It seems to be a default reference for .net project. How can I do for passing the compiling?

Thanks!

Teflon
17 Sep 2007, 7:46 AM
Hi, Teflon:
When I bulid my new project for the scripts, AssemblyInfo.cs file cann't pass the compiling. The error is :
Type “System.Reflection.AssemblyFileVersionAttribute” exist in “e:\Mine\Framework\Libs\sscorlib.dll”and “c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll”

But I never add the mscorlib.dll to my project, It seems to be a default reference for .net project. How can I do for passing the compiling?

Thanks!

Open up the .csproj file in notepad and add the <NoStdLib> tag into the first <PropertyGroup> tag


<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{632C3D63-8FFB-4023-BCDB-E15ECADDB943}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DemoScripts</RootNamespace>
<AssemblyName>DemoScripts</AssemblyName>
<NoStdLib>True</NoStdLib>
<CopyReferences>True</CopyReferences>
<TemplateFile>Properties\Script.jst</TemplateFile>
</PropertyGroup>

This should have been set if you chose a Script# Class Library project

sonkey
17 Sep 2007, 8:01 AM
Thanks for reply. It works.

What is the use of SourceConverter and how to use it. Could you give me some introdution?

Thanks!

Teflon
17 Sep 2007, 8:21 AM
Thanks for reply. It works.

What is the use of SourceConverter and how to use it. Could you give me some introdution?

Thanks!

You don't need to touch that project unless you feel you need to modify the ExtJS C# API.

Basically, it works like this. The Converter program, reads the ext1.1 javascript source files and creates C# API files compatible with Script#. This API is just a replica of the ExtJS API but in C#. You need to reference the ExtJsApi.dll in your own project, which allows you to write C# code that will talk to the Ext# API. When you compile your own project, it will be converted into javascript by Script# that will run in the browser and actually communicate with the ExtJS API.

I hope I didn't lose you in all that. You really need to understand how Script# works for it all to make sense.

leantruts
17 Sep 2007, 9:38 AM
Hi,

When a trying to edit the scriptlet in Visual Web Developer Express Edition, this error appears:

---------------------------
There was an error creating a C# project to edit the code.
Please try re-opening the solution, or edit the code by switching to source view.
---------------------------

What i have to do is this case?

Tks !!! ;)

Teflon
17 Sep 2007, 3:26 PM
Hi,

When a trying to edit the scriptlet in Visual Web Developer Express Edition, this error appears:

---------------------------
There was an error creating a C# project to edit the code.
Please try re-opening the solution, or edit the code by switching to source view.
---------------------------

What i have to do is this case?

Tks !!! ;)

I'm not 100% sure but I don't think that Script# works with the Express Edition

sjf
18 Sep 2007, 2:49 AM
Hi, Got this all working now. Great demo.
I just wanted to find out if you find the grid paging very slow. The callback is not the issue however the javascript to render the new grid takes an age. I tried reducing the paging size to 15 but this did not make much difference. Is it an issue with using so many columns.
Below is the firebug profile of the script after I have click to move to the next page

http://extjs.com/forum/attachment.php?attachmentid=1756&stc=1&d=1190112167

It seems the culprit is the 180 calls to CSS, if I do the same profile on the grid in the Examples & Demos this method does not get called at all. Any idea on how to correct this or why this is? This is my first day playing with extjs.

Cheers
Steve

Teflon
18 Sep 2007, 6:16 AM
Hi, Got this all working now. Great demo.
I just wanted to find out if you find the grid paging very slow. The callback is not the issue however the javascript to render the new grid takes an age. I tried reducing the paging size to 15 but this did not make much difference. Is it an issue with using so many columns.
Below is the firebug profile of the script after I have click to move to the next page

http://extjs.com/forum/attachment.php?attachmentid=1756&stc=1&d=1190112167

It seems the culprit is the 180 calls to CSS, if I do the same profile on the grid in the Examples & Demos this method does not get called at all. Any idea on how to correct this or why this is? This is my first day playing with extjs.

Cheers
Steve

I wish I could give you an answer but I honestly do not know. I too noticed the grid rendered slowly but I just chalked it up to being caused by the amount of data/columns.

FritFrut
18 Sep 2007, 6:57 AM
First, the bug:
In ExtEventCollection.cs, string 'Deletage' should be 'Delegate'.

A new version of ParseLastLine function (from ExtClass.cs)

private static string[] ParseLastLine(string[] data) {
string[] lastLine = new string[0];
string ds = data[data.Length - 1] ;

if (ds.Contains("=") || ds.Contains(":"))
{
char[] sep = {':', ',', '=', ' '} ;
lastLine = ds.Split(sep, StringSplitOptions.RemoveEmptyEntries) ;
}
return lastLine;
}
This handles things like

functionName: function ...
, functionName : function ...
etc.

HTH, Tom

Teflon
18 Sep 2007, 7:13 AM
FritFrut,

Thanks for pointing out the misspelling. I'll update the code in svn. Making this change will break any code using the generated Delegates but since we have a compiler, those errors are easily fixed.

Regarding the ParseLastLine method, I'm not sure that code you posted will work. I don't want to split on spaces or commas because the return value of this method is expected to be an array of 2 strings. The first string being the text on the left of the "=" or ":" sign. The second string being whats on the right of the "=" or ":" sign. Since I've released this to the public, I guess I should document my code :(

Thanks for your suggestions

FritFrut
18 Sep 2007, 9:30 AM
Regarding the ParseLastLine method, I'm not sure that code you posted will work.
I tried it, and I'm using it, and it seems to work...


I don't want to split on spaces or commas because the return value of this method is expected to be an array of 2 strings. The first string being the text on the left of the "=" or ":" sign. The second string being whats on the right of the "=" or ":" sign. Since I've released this to the public, I guess I should document my code :(

I split on spaces and commas to handle cases where theres more or less than one blank between the name and the "=" or ":". The RemoveEmptyEntries value means empty strings will be discarded. Also, "," is used to handle cases like this

{
name1: value1
, name2: value2
}
which is used, for example, in Accordion extension (by Saki).

But, this one is simpler and better:

private static string[] ParseLastLine(string[] data) {
string[] lastLine = new string[0];
string ds = data[data.Length - 1].TrimStart(',') ;

if (ds.Contains("=") || ds.Contains(":"))
{
char[] sep = {':', '='} ;
lastLine = ds.Split(sep, 2, StringSplitOptions.RemoveEmptyEntries) ;
}
return lastLine;
}

Note that this checks and splits only on characters '=' and ':', unlike original code which looked for ' = ' and ' : '. This will not return empty strings, and only split in 2 parts. Parameter 2 will ensure that the string values which contain : or = will not be split. For example, this:

somekey: "blah = something else",
should be ok.

HTH, Tom

FritFrut
18 Sep 2007, 10:04 AM
I wish I could give you an answer but I honestly do not know. I too noticed the grid rendered slowly but I just chalked it up to being caused by the amount of data/columns.

I replaced ext-all.js with ext-all-debug.js, and noticed a lots of calls to autoSizeColumn which call the updateRule method. I set all autoSizeColumns to false, and removed callback in CreateGrid and it is better. However, even after that, there are 4 calls to

updateRule("#supplier-grid .x-grid-col-1" and 2

updateRule("#category-grid .x-grid-hd-1",
even before I click on the 'Product Categories' and 'Product Suppliers' buttons.

Anyhow, it seems that the problem is in the demo, and not in the library.

HTH, Tom

Teflon
18 Sep 2007, 3:11 PM
I tried it, and I'm using it, and it seems to work...

But, this one is simpler and better:

private static string[] ParseLastLine(string[] data) {
string[] lastLine = new string[0];
string ds = data[data.Length - 1].TrimStart(',') ;

if (ds.Contains("=") || ds.Contains(":"))
{
char[] sep = {':', '='} ;
lastLine = ds.Split(sep, 2, StringSplitOptions.RemoveEmptyEntries) ;
}
return lastLine;
}

Note that this checks and splits only on characters '=' and ':', unlike original code which looked for ' = ' and ' : '. This will not return empty strings, and only split in 2 parts. Parameter 2 will ensure that the string values which contain : or = will not be split. For example, this:

somekey: "blah = something else",
should be ok.

HTH, Tom

Thanks for the code, I've changed my code to the snippet above.

Teflon
18 Sep 2007, 3:40 PM
I've made some updates, one of which is my first go round at typed config object. I'm not really all that pleased with my first attempt but I'll share and maybe someone has a better method.

Original Method (no intellisense)

ColumnModel colModel = new ColumnModel(new Dictionary[] {
new Dictionary("id", "company", "header", "Company", "width", 160, "sortable", true, "locked", false, "dataIndex", "company"),
new Dictionary("header", "Price", "width", 75, "sortable", true, "renderer", new StringRenderer(Format.usMoney), "dataIndex", "price"),
new Dictionary("header", "Change", "width", 75, "sortable", true, "renderer", new NumberRenderer(Change), "dataIndex", "change"),
new Dictionary("header", "% Change", "width", 75, "sortable", true, "renderer", new NumberRenderer(PctChange), "dataIndex", "pctChange"),
new Dictionary("header", "Last Updated", "width", 85, "sortable", true, "renderer", Format.dateRenderer("m/d/Y"), "dataIndex", "lastChange")
});

New Method (config intellisense)

ColumnModel colModel1 = new ColumnModel(new Dictionary[] {
Config.create(
ColumnModelConfig.header, "Company",
ColumnModelConfig.width, 160,
ColumnModelConfig.sortable, true,
ColumnModelConfig.locked, false,
ColumnModelConfig.dataIndex, "company"
),
Config.create(
ColumnModelConfig.header, "Price",
ColumnModelConfig.width, 75,
ColumnModelConfig.sortable, true,
ColumnModelConfig.renderer, new StringRenderer(Format.usMoney),
ColumnModelConfig.dataIndex, "price"
),
Config.create(
ColumnModelConfig.header, "Change",
ColumnModelConfig.width, 75,
ColumnModelConfig.sortable, true,
ColumnModelConfig.renderer, new NumberRenderer(Change),
ColumnModelConfig.dataIndex, "price"
),
Config.create(
ColumnModelConfig.header, "% Change",
ColumnModelConfig.width, 75,
ColumnModelConfig.sortable, true,
ColumnModelConfig.renderer, new NumberRenderer(PctChange),
ColumnModelConfig.dataIndex, "pctChange"
),
Config.create(
ColumnModelConfig.header, "Last Updated",
ColumnModelConfig.width, 75,
ColumnModelConfig.sortable, true,
ColumnModelConfig.renderer, Format.dateRenderer("m/d/Y"),
ColumnModelConfig.dataIndex, "lastChange"
)
});

Another Possibility (not implemented)
This method is nice because you get type checking along with intellisense. But you lose the ability to do inline configs. I wish I could use VS2008's new Object Initializer syntax.

ColumnModelConfig cmConfig1 = new ColumnModelConfig();
cmConfig1.header = "% Change";
cmConfig1.width = 75;
cmConfig1.sortable = true;
cmConfig1.renderer = new NumberRenderer(PctChange);
cmConfig1.dataIndex = "pctChange";

ColumnModelConfig cmConfig2 = new ColumnModelConfig();
cmConfig2.header = "Last Updated";
cmConfig2.width = 75;
cmConfig2.sortable = true;
cmConfig2.renderer = Format.dateRenderer("m/d/Y");
cmConfig2.dataIndex = "lastChange";

ColumnModel colModel = new ColumnModel(new Dictionary[] { cmConfig1.ToDictionary(), cmConfig2.ToDictionary() });

The good news is that I have some flexibility on how this is implemented, I'm just not sure what's the best way. I'd like some feedback from you guys.

briandunnington
18 Sep 2007, 4:23 PM
after looking at Script# awhile ago and never really getting around to playing with it much, i just downloaded your example project and played around with it a bit. i set up a new project and created a super-simplistic project just to see how it worked from the ground up. i must admit that coding in C# is a huge productivity boost for me (just the complie-time checking alone saves a lot of debugging time). great job on this so far.

anyway, i like what you have going here, and although some people think that having the DLR inside of Silverlight will make this less useful, i disagree. there will continue to be a place for 'native' web applications (ie: dont require a browser plug-in to run). this is where Ext shines (in my opinion). the success of GWT also speaks to the usefulness of allowing programmers to work in an language/environment that they are more proficient at.

i know this is a work in-progress, but i do have a one concern. what do you think can be done about 'framework bloat' - in other words, although you get a lot for the size of the Ext framework, it is not super tiny. now with this wrapper, there is another wrapper around that (ExtJSApi.js) that is another 22kb even when minified. add in at least another 42kb for the base sscorlib.js, plus possibly more if you use any of the other components (fx, UI.Forms, etc). perhaps that is just the price to pay to enable this functionality, but something to keep in mind.

PS: in the sample code in your .zip file on googlecode, it does not compile out-of-the-box. the error is that 'no method for form.fieldset takes 10 parameters' - i think you said you changed this to use the 'params' keyword, but maybe that change didnt make it into the .zip file?

briandunnington
18 Sep 2007, 4:34 PM
regarding your ideas for a configuration object...

this would be a little non-standard (at least in c#, not as much in javascript), but what about a combination of your suggested methods:


ColumnModel colModel1 = new ColumnModel(new Dictionary[] {
Config.create(
ColumnModelConfig.header("Company"),
ColumnModelConfig.width(160),
ColumnModelConfig.sortable(true),
ColumnModelConfig.locked(false),
ColumnModelConfig.dataIndex("company")
),
...etc...
});

you are using methods to set what would normally be properties, but then you get the type checking and you can still do inline configurations. i dont know, i am not sure i like it, but just throwing ideas out there.

Teflon
18 Sep 2007, 8:18 PM
i know this is a work in-progress, but i do have a one concern. what do you think can be done about 'framework bloat' - in other words, although you get a lot for the size of the Ext framework, it is not super tiny. now with this wrapper, there is another wrapper around that (ExtJSApi.js) that is another 22kb even when minified. add in at least another 42kb for the base sscorlib.js, plus possibly more if you use any of the other components (fx, UI.Forms, etc). perhaps that is just the price to pay to enable this functionality, but something to keep in mind.

I haven't even been paying attention to the script size, silly me. After taking a look at the script, there is a rather simple way to decrease this size, but you will lose some some functionality within the IDE. If you comment out the line "sb.Append(Events.ToString(Name));" in the ExtClass.ToString() method, you will end up with a much smaller ExtJsApi.js file (only the ScriptSharpAdapter code). In turn, you will lose the *Events classes. Now, after playing with the config objects, it seems I've managed to increase the api js even more to about 70KB. I guess its the price to pay to make our lives easier. I'm open for suggestions ...



PS: in the sample code in your .zip file on googlecode, it does not compile out-of-the-box. the error is that 'no method for form.fieldset takes 10 parameters' - i think you said you changed this to use the 'params' keyword, but maybe that change didnt make it into the .zip file?
Thanks, I wasn't aware of that. I've just packaged up v0.0.2 which contains all of the changes I've made (see changelog (http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt)). And I've tested the zips to make sure everything works out of the box. Unfortunately, I'm having some issues uploading the files to google. Getting permission denied errors. I'll keep trying ...

albeva
19 Sep 2007, 4:03 AM
Good work so far. I had a little play around with it, but I am wondering if it does support c# 3 features?

Teflon
19 Sep 2007, 5:18 AM
Good work so far. I had a little play around with it, but I am wondering if it does support c# 3 features?

I haven't tried but I'm sure it doesn't.

Teflon
19 Sep 2007, 5:18 AM
regarding your ideas for a configuration object...

this would be a little non-standard (at least in c#, not as much in javascript), but what about a combination of your suggested methods:


ColumnModel colModel1 = new ColumnModel(new Dictionary[] {
Config.create(
ColumnModelConfig.header("Company"),
ColumnModelConfig.width(160),
ColumnModelConfig.sortable(true),
ColumnModelConfig.locked(false),
ColumnModelConfig.dataIndex("company")
),
...etc...
});

you are using methods to set what would normally be properties, but then you get the type checking and you can still do inline configurations. i dont know, i am not sure i like it, but just throwing ideas out there.

I like this method, I will give it a shot

FritFrut
20 Sep 2007, 1:11 PM
You should probably use version 1.1.1 instead of 1.1.
Also, DialogManager is not marked as singleton in doc, so, until this is corrected (I've posted a bug) you could mark it manually and regenerate ExtJSApi dlls.

Cheers, Tom

Teflon
20 Sep 2007, 1:37 PM
You should probably use version 1.1.1 instead of 1.1.
Also, DialogManager is not marked as singleton in doc, so, until this is corrected (I've posted a bug) you could mark it manually and regenerate ExtJSApi dlls.

Cheers, Tom

Yeah I was thinking of versioning it like 1.1.x which maps to the ExtJS 1.1 release. The x would be my internal build numbers that I increment. Then when ExtJS 2.0 is released, I can change the version to 2.0.x and so on.

It's pretty simple to mark DialogManager as a singleton, a one-liner. The change will be applied to my next commit

Teflon
22 Sep 2007, 3:03 PM
I've made some updates, see the change log (http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt) for all the details.

I just wanted to show my solution to the Ext config objects. The comments in the image explains it all.

http://extsharp.googlecode.com/svn/trunk/Images/ext_config_create.png

mdissel
24 Sep 2007, 1:32 AM
i know this is a work in-progress, but i do have a one concern. what do you think can be done about 'framework bloat' - in other words, although you get a lot for the size of the Ext framework, it is not super tiny. now with this wrapper, there is another wrapper around that (ExtJSApi.js) that is another 22kb even when minified. add in at least another 42kb for the base sscorlib.js, plus possibly more if you use any of the other components (fx, UI.Forms, etc). perhaps that is just the price to pay to enable this functionality, but something to keep in mind.

I agree with you. It seems there's a lot of overlap in the sscorlib.js with Ext.. Maybe remapping them on Ext functions would make the implementation of the extra scripts obsolete.

Thanks

Marco

albeva
24 Sep 2007, 1:48 AM
I've made some updates, see the change log (http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt) for all the details.

I just wanted to show my solution to the Ext config objects. The comments in the image explains it all.

http://ext.ordereze.net/scriptsharp/ext_config_create.png


I like this method, I will give it a shot
How about taking this just a bit further :
ColumnModel colModel1 = new ColumnModel(new Dictionary[] {
Config.create(
ColumnModelConfig.header("Company")
.width(160)
.sortable(true)
.locked(false)
.dataIndex("company")
),
...etc...
}); This will save some typing. simply let each method return a reference to itself.

Teflon
24 Sep 2007, 10:17 AM
I agree with you. It seems there's a lot of overlap in the sscorlib.js with Ext.. Maybe remapping them on Ext functions would make the implementation of the extra scripts obsolete.

Thanks

Marco
My primary goal of this project to is make programming with ExtJS easier for C# developers. Unfortunately, with that comes some drawbacks, such limitations due to the differences in the languages, as well as increased script size. I'm currently focused on overcoming the limitations so I can make use of all of the functionality that ExtJS provides. If anyone wants to help getting the script size down, I'd love the assistance. All of the source code is available on the GoogleCode project.



How about taking this just a bit further :
ColumnModel colModel1 = new ColumnModel(new Dictionary[] {
Config.create(
ColumnModelConfig.header("Company")
.width(160)
.sortable(true)
.locked(false)
.dataIndex("company")
),
...etc...
}); This will save some typing. simply let each method return a reference to itself.
I like this method. I'll add this as soon as I get a chance. Thanks for the comment.

Teflon
24 Sep 2007, 3:11 PM
Added the ability to chain the config definition. Config.create() isn't even necessary. I think this is the best method of them all. Thanks again for the suggestion albeva

http://extsharp.googlecode.com/svn/trunk/Images/ext_config_instance.png

albeva
26 Sep 2007, 2:53 AM
Great job. Look good!

reza_62
26 Sep 2007, 3:17 AM
I download last version of your toolkit but it hasn't BasicDialogConfigInst when you publish this changes into your toolkit
thanks ;)

sonkey
27 Sep 2007, 11:10 PM
There are two bugs in "Store.cs"


/// <summary></summary>
/// <returns></returns>
public void getTotalCount() { return 0;}

/// <summary></summary>
/// <returns></returns>
public void getSortState() { return ;}

should be


/// <summary></summary>
/// <returns></returns>
public int getTotalCount() { return 0;}

/// <summary></summary>
/// <returns></returns>
public object getSortState() { return null;}

Choleriker
28 Sep 2007, 1:43 AM
Hello,

i just started to played around with you very nice solution. I found it very useful because i spent many time with writing javascript. After start, i just wanted to make a simple ajax-call to check how to use your library. So i cant find the method Ajax.request() in your generated class definition. Why? Why your parser hasnt find that method?

Regards, Michael

FritFrut
28 Sep 2007, 3:52 AM
Why? Why your parser hasnt find that method?
The parser is not actually parsing JavaScript code, it parses documentation to find the methods, properties and classes and generate C# code, so anything that is not well documented will not be parsed. As a workaround, if you know what you need, you may use Script# calls:

Type.GetField(object, string)
and

Type.InvokeMethod(object, string, params object[])
to get/set the fields and call the methods that are not parsed.

HTH, Tom

Teflon
28 Sep 2007, 11:32 AM
I just packaged up v1.1.4. There is a breaking change. I removed the static Config classes and renamed the ConfigInst classes to be just Config classes. I also removed the Ext.Config class as this is no longer necessary.


I download last version of your toolkit but it hasn't BasicDialogConfigInst when you publish this changes into your toolkit
thanks ;)
Yeah that's because I only committed the code to SVN. I've just updated the packaged zips to include all of the changes up to now.


There are two bugs in "Store.cs"


/// <summary></summary>
/// <returns></returns>
public void getTotalCount() { return 0;}

/// <summary></summary>
/// <returns></returns>
public void getSortState() { return ;}

should be


/// <summary></summary>
/// <returns></returns>
public int getTotalCount() { return 0;}

/// <summary></summary>
/// <returns></returns>
public object getSortState() { return null;}

Noted ... I will fix. This really isn't a bug, its due to the return type not being documented. I guess the only way to fix this is to make the assumption that if a method name starts with "get", it returns something, therefore I'll set its return type to object and you will have to cast it to what it really is.


Hello,

i just started to played around with you very nice solution. I found it very useful because i spent many time with writing javascript. After start, i just wanted to make a simple ajax-call to check how to use your library. So i cant find the method Ajax.request() in your generated class definition. Why? Why your parser hasn't find that method?

Regards, Michael
FritFrut's solution would solve your problem, but I will add that class in the next build. If you find any more missing classes/methods/etc. just let me know and I'll add it in manually. Like FritFrut said, the parser only looks at the doc comments, so if theres no comment, it wont generate the code. I can only add code manually for the portions of Ext that I use and realize is missing. I've started rebuilding the Docs & Demos website using just ExtSharp so that I can cover more of the code to find out whats missing.

toreinar
29 Sep 2007, 6:57 AM
Have you tried to run your API-builder against Ext 2.0 ?

reza_62
30 Sep 2007, 1:56 AM
thanks it is very intersting ;)

Teflon
30 Sep 2007, 4:53 AM
Have you tried to run your API-builder against Ext 2.0 ?
Nope, I do not have Ext 2.0 source. I will begin working with it as soon as a beta is made public.

mdissel
30 Sep 2007, 10:25 AM
Have you tried to run your API-builder against Ext 2.0 ?

I did, but it doesn't compile because of missing documentation in the current 2.0 codebase..

Thanks

Marco

Teflon
1 Oct 2007, 6:53 AM
Expect an update by the end of the week of ScriptSharp working with Ext 2.0. I think I'm going to drop support for Ext 1.1 since I don't think anyone is actually using this with Ext 1.1.

mdissel
1 Oct 2007, 9:28 AM
Good idea =D>

FritFrut
2 Oct 2007, 7:04 AM
This method is not parsed. To use, add this code:

/// <summary></summary>
/// <param name="obj">The receiver of the properties</param>
/// <param name="config">The source of the properties</param>
/// <param name="defaults">A different object that will also be applied for default values</param>
/// <returns>object</returns>
public static object apply(object obj, object config, object defaults) { return null ; }

in MoreCode\Ext.txt, run, and recompile ExtJsApi.

Cheers, Tom

jadedgeek
3 Oct 2007, 5:21 AM
Teflon, Tom...

First off, great work, admire your initiative with this "fusion" of technologies if you will.

I noticed that you've actually started working on support EXT 2.0alpha and curious as to how far along you are with it in terms of being able to test it out. (what working, what's not)

I haven't actually checked anything out yet, as I just stumbled across this last night, and I have to review Script# again .... so I possibly help with this initiative.

Teflon
3 Oct 2007, 5:42 AM
I have actually finished fixing the converter to properly parse the ext2.0alpha javascripts. The outputted ExtSharp API does compile with no errors. My plan is to recreate some of the Ext2.0 samples using the new api to try and find missing/incorrect code. At some point (hopefully this weekend) I will bundle it all up for a release. I have to learn the new ext code so it may take a little longer. For right now, feel free to checkout the source from svn if you wish to play with it, and definitely report issues that you may come across. If you have previously checked out code from svn you may want to start with a fresh checkout this time because I made a bunch of name changes to folders and projects.

Tom,
Thanks, I've added that missing code to svn.

FritFrut
3 Oct 2007, 7:04 AM
Teflon, Tom...

First off, great work, admire your initiative with this "fusion" of technologies if you will.


Thanks, but the idea and all the work is done by Teflon, so all the credits go there.

jadedgeek
3 Oct 2007, 10:58 AM
Thanks, but the idea and all the work is done by Teflon, so all the credits go there.

Yes, agreed... however, Ive seen your name mentioned a couple times in the CHANGELOG so figured I thank you as well. ;)

jadedgeek
3 Oct 2007, 11:07 AM
I have actually finished fixing the converter to properly parse the ext2.0alpha javascripts. The outputted ExtSharp API does compile with no errors. My plan is to recreate some of the Ext2.0 samples using the new api to try and find missing/incorrect code. At some point (hopefully this weekend) I will bundle it all up for a release. I have to learn the new ext code so it may take a little longer. For right now, feel free to checkout the source from svn if you wish to play with it, and definitely report issues that you may come across. If you have previously checked out code from svn you may want to start with a fresh checkout this time because I made a bunch of name changes to folders and projects.

Tom,
Thanks, I've added that missing code to svn.

Tom,

That's crazy... I'm definitely psyched and will be playing with it tonight. I'll try and demonstrate all the examples if I can figure it all out myself. If I'm feeling brave, I'll request permission to commit to SVN repo ;)

Cheers

Teflon
3 Oct 2007, 12:15 PM
All I need to give you commit access is your google account email address. You can send it to me in a private message on this forum. No need to feel brave, I welcome any and all who wish to help. I promise I won't get mad if you break something. With the power of a compiler, fixing code becomes very easy.

Once I get rolling on creating the samples, I'll also create a quick "Getting Started" video tutorial for using ExtSharp and setting up your first "Hello World" project.

Thank you to everyone who's offered their comments and suggestions, I really appreciate the positive response from the community.

jadedgeek
3 Oct 2007, 3:48 PM
All I need to give you commit access is your google account email address. You can send it to me in a private message on this forum. No need to feel brave, I welcome any and all who wish to help. I promise I won't get mad if you break something. With the power of a compiler, fixing code becomes very easy.

Once I get rolling on creating the samples, I'll also create a quick "Getting Started" video tutorial for using ExtSharp and setting up your first "Hello World" project.

Thank you to everyone who's offered their comments and suggestions, I really appreciate the positive response from the community.

I'll touch base with you shortly... =P~ let me get a grasp on the whole thing before I go committing changes or mods.

one of my main concerns is the latency or speed of the ext library now with this coupling. 2.0 made some dramatic changes in terms of improved UI generation... so I want to see how it all plays out.

Cheers

consultutah
4 Oct 2007, 12:45 PM
I know that we are jumping the gun a little bit, but I'm having a few issues with the SVN code:
1. Ext's Function type is not being converted to System.Delegate. I think that you just need to add a case in ExtType.ParseType to change "Function" -> "Delegate"
2. Shouldn't Ext.Array inherit from Script#'s System.Array class (which happens to be one of the few that don't have sealed slapped on it)? For example Ext.Array, shouldn't it be:


namespace Ext {
public class Array : System.Array {
...
}
}

Anyway, just wanted to say thanks for having written this in the first place. We started a project using the first version and are biting at the nails to get moving on this version. I've got a team of 5 people right now working on a project where we would love to use this. If we could get commit access for one of them, we could help push this project along for the next few months at least.

Update: Forget #2 - I just found-out that even though System.Array is not marked as sealed, you can't inherit from it... In v1.1, you just skipped this class, is there a mechanism for excluding classes?

Teflon
4 Oct 2007, 3:46 PM
consultutah,
Thanks for pointing out those issues. I'll have the Function issue fixed as soon as i get back into the code. I'll also implement a simple method for excluding classes. I find that the Function, String, Array, & Date classes aren't very usable from within Script#. I'm still trying to figure out a way to include the functionality of those classes into the api, but Script#'s sealed classes make it difficult.

Just pm me the google accounts for anyone who needs commit access. I'll add as many people as you like. I'd prefer this to be community driven than to be led by me alone as I really don't have the resources to support it alone.

I am going to be starting on a fairly large project myself and I'll be using ExtSharp for it. This was my motivation for testing ExtJS out with Script#. I feel I can better build and maintain the app using vs.net/c#. I was just waiting on was Ext 2.0 release to get started. It's full steam ahead now.

Teflon
8 Oct 2007, 2:13 PM
#region Cry for help

For the past few days I have been really struggling trying to get around an inheritance problem with Script#. I encountered this problem when trying to recreate the samples index page using ExtSharp. The samples.js script creates a new class that extends Ext.Panel. When I tried to replicate this using c# inheritance syntax I realized that Script# doesn't use the true prototype inheritance that ExtJS uses. Script# simply copies all members from the base class into the new class, without creating the link to the base class like ExtJS does in Ext.extend(). When I create a class that inherits from Ext.Panel, the script fails because in the addTool method, Ext creates a new property on the Ext.Panel prototype. Here's the addTool method (starts on line 624 of source/widgets/Panel.js)


addTool : function(){
if(!this[this.toolTarget]) { // no where to render tools!
return;
}
if(!this.toolTemplate){
// initialize the global tool template on first use
var tt = new Ext.Template(
'<div class="x-tool x-tool-{id}">&#160</div>'
);
tt.disableFormats = true;
tt.compile();
Ext.Panel.prototype.toolTemplate = tt;
}
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
var tc = a[i], overCls = 'x-tool-'+tc.id+'-over';
var t = this.toolTemplate.insertFirst(this[this.toolTarget], tc, true);
this.tools[tc.id] = t;
t.enableDisplayMode('block');
t.on('click', this.createToolHandler(t, tc, overCls, this));
if(tc.on){
t.on(tc.on);
}
if(tc.hidden){
t.hide();
}
t.addClassOnOver(overCls);
}
},

When using Ext.extend() to perform inheritance, this works fine. But using Script#'s inheritance method, this fails because the link to the base class is not there, therefore changes to the prototype of the base class after the new class has been created do not affect the new class. I've spent the last few days trying to rewrite/hack some of Script#'s functions that create the classes to work around this problem but I haven't gotten anywhere. I've really learned a heck of a lot about javascript inheritance, and I completely understand the problem and why it's happening, I just can't come up with a working solution.

If anyone out there is willing to take a stab at it, please be my guest. What I have so far in the samples project is in svn.

Here are the relevant portions of sscorlib.debug.js that I think need to be modified. It's in the setupBase() function where the *quote* inheritance *quote* is being created.


Type.prototype.createClass = function Type$createClass(name, baseType, interfaceType) {
this.prototype.constructor = this;
this.__typeName = name;
this.__class = true;
this.__baseType = baseType || Object;
if (baseType) {
this.__basePrototypePending = true;
}

if (interfaceType) {
this.__interfaces = [];
for (var i = 2; i < arguments.length; i++) {
interfaceType = arguments[i];
this.__interfaces.add(interfaceType);
}
}
}

Type.prototype.setupBase = function Type$setupBase() {
if (this.__basePrototypePending) {
var baseType = this.__baseType;
if (baseType.__basePrototypePending) {
baseType.setupBase();
}

for (var memberName in baseType.prototype) {
var memberValue = baseType.prototype[memberName];
if (!this.prototype[memberName]) {
this.prototype[memberName] = memberValue;
}
}

delete this.__basePrototypePending;
}
}

Type.prototype.constructBase = function Type$constructBase(instance, args) {
if (this.__basePrototypePending) {
this.setupBase();
}

if (!args) {
this.__baseType.apply(instance);
}
else {
this.__baseType.apply(instance, args);
}
}


#endregion // Cry for help

FritFrut
9 Oct 2007, 9:30 AM
If anyone out there is willing to take a stab at it, please be my guest.
Sorry, don't have the time ATM, but just an idea... could you use Ext's createInterceptor, and put it after the sscorlib.js?

jadedgeek
26 Oct 2007, 8:35 PM
Great work guys, keep up the good work.

xarux
1 Nov 2007, 7:32 AM
Hi all,

I want to generate the ColumnModel for the grid from a database, so like the following code I need to create a Dictionary in a loop and use it as a config for the ColumnModel.


ColumnModel cm = new ColumnModel(new Dictionary[] {
new ColumnModelConfig().header("Col1").dataIndex("COL1").ToDictionary(),
new ColumnModelConfig().header("Col2").dataIndex("COL2").ToDictionary(),
});

But I can't add any reference to System.Data to a Script# project since it needs mscorlib. sscorlib and mscorlib can't be in the same project as far as I see. So how can I achieve this? I'm not able to get any data to PageScripts project because of the reference confusion.

Teflon
1 Nov 2007, 8:14 AM
I know it can be a little confusing but you have to remember that all code in the Script# project is being run on the client in the browser. The code is converted to javascript which cannot connect directly to a database. You have to retrieve data using Ajax calls using either ExtJS or using Script#'s XMLHttpRequest object.

xarux
2 Nov 2007, 12:22 AM
Thanks for the reply Teflon, you are absolutely right. I quickly created a GridHandler.ashx like :


System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (dtCols != null)
{
sb.Append("[");
foreach (dsEWS.EWS_GRID_COLUMNSRow drCol in dtCols.Rows)
{
sb.Append("{");
sb.AppendFormat("dataIndex:\"{0}\", header:\"{1}\", hidden:{2}", drCol.COL_FIELD_NAME, drCol.COL_HEADER_EN, drCol.COL_VISIBLE.Equals(0).ToString().ToLower());
sb.Append("},");

}
sb.Remove(sb.Length - 1, 1);
sb.Append("]");
}
context.Response.Write(sb.ToString());

And on the PageScripts I parse it like this :


Dictionary[] cfg = (Dictionary[])Dictionary.Parse(_request.ResponseText);
ColumnModel cm = new ColumnModel(cfg);


Everything works fine, but with a strange problem. Some columns are showing empty. I checked everything, dataIndex is corrrect, value type is correct. But it just doesn't show the value.

This is a row :


{totalCount:1, results: [{"ROWNO":"3", "ID":"2", "PROJECT_ID":"1", "ORDER_CODE":"M000000002", "SENDER_COMPANY_NAME":"COMPANY A", "DELIVERY_COMPANY_NAME":"COMPANY B", "BOL_NO":"19865", "ATF_NO":"B687069"}]


And here is the generated columnModel :



[{dataIndex:"ROWNO", header:"r", hidden:false}, {dataIndex:"ID", header:"ID",hidden:false}, {dataIndex:"PROJECT_ID", header:"Project", hidden:false}, {dataIndex:"ORDER_CODE", header:"Order Nr", hidden:false}, {dataIndex:"SENDER_COMPANY_NAME", header:"Sender", hidden:false}, {dataIndex:"DELIVERY_COMPANY_NAME", header:"Delivery", hidden:false},{dataIndex:"BOL_NO", header:"BOL", hidden:false}, {dataIndex:"ATF_NO", header:"ATF", hidden:false}]


And here is the output:
http://services.ekol.com/temp/sshot-4.png

Any ideas anyone?

[UPDATE]
Sorry to bother guys, I jus't didn't define the corresponding DataStore definition in CreateStore method. I fixed it, thank you.

sreedharp
3 Nov 2007, 5:59 AM
Great job with Script#. we developed a project with the Script# and ASP.NET.While deploying it to server "That assembly does not allow partially trusted callers" error occuring.

Can anybody help me?
Please specify the steps to upload the project to server.

And here are my few questions
1.What are the needed dll's to upload?
2.Can we install "ScriptSharp-v0.4.2.msi" in deploying mechine?

Please reply.

DragonFist
3 Nov 2007, 7:01 PM
I don't know exactly your scene but I ran into that error with infragistic controls.

It has to do with the trust level of the server being set to medium. If you can get the hosting company to change this, it is the best way to fix it.

Otherwise, you have to find out what assembly you have that is strongly named and won't allow medium-trust calls and somehow fix it.

I had done a google and found several tools for this but it was a daunting task. Fortunately, for me, I found out infragistics has a version of their .dll's that allowed medium-trust calls for just such situations.

sqhehe
7 Nov 2007, 1:21 AM
http://extjs.com/forum/attachment.php?attachmentid=2601&stc=1&d=1194426553

http://extjs.com/forum/attachment.php?attachmentid=2599&stc=1&d=1194426555

http://extjs.com/forum/attachment.php?attachmentid=2600&stc=1&d=1194426555

whoever
13 Nov 2007, 2:41 PM
I saw this was mentioned before. Has anyone found out why the sample product page load so slow? There's no reason to take 15 seconds to load a 9x30 grid on localhost. Thanks.

Teflon
13 Nov 2007, 3:09 PM
The problem is that, for whatever reason, I decided to automatically resize each column based on it's content whenever the store is loaded. Remove the following lines from the CreateGrid() method in ProductsPage.cs and you should notice an increase in the performance.



ds.on(StoreEvents.load,
new StoreLoadDelegate(delegate(Store store, Record[] records, object options) {
int count = _productsGrid.getColumnModel().getColumnCount();
for (int i = 0; i < count; i++) {
_productsGrid.getView().autoSizeColumn(i, true);
}
}),
this,
null
);


Sidebar: I have been building an app using ExtSharp+ExtJS2.0 and I must say there is a huge boost in performance throughout the entire framework especially in the grid. Many thanks to the ExtJS team for a phenomenal job.

whoever
13 Nov 2007, 4:49 PM
It does make a difference. Thanks. Couldn't wait for the new release. It's such an amazing piece work. So much talent out there, make me want to quit :">

whoever
20 Nov 2007, 7:59 AM
Hi, hope you still track this thread. After further reading, I notice you mentioned that your intellisense is built by parsing the comments in the library. If that's the case, can it deal with situation like this?


Ext.MessageBox.show({
title: 'Paragraph Clicked',
msg: paragraph.dom.innerHTML,
width:400,
buttons: Ext.MessageBox.OK,
animEl: paragraph
});

In this case, all the options like title, msg, width, etc. are not parameters, but descriptions quoted in pre tag in the comments. Can you still get any type of reference or hints while doing something equivalent to this?

Thanks.

Teflon
22 Nov 2007, 7:53 PM
In this case, all the options like title, msg, width, etc. are not parameters, but descriptions quoted in pre tag in the comments. Can you still get any type of reference or hints while doing something equivalent to this?

Unfortunately, it would be pretty tough to parse syntax within the script comments. But the api for this class can be added fairly easily. A MessageboxConfig class just needs to be created, then you would be able to accomplish what you want using this code:


Ext.MessageBox.show(new MessaqeBoxConfig()
.title("Paragraph Clicked")
.msg(paragraph.dom.innerHTML)
.width(400)
.buttons(Ext.MessageBox.OK)
.animEl(paragraph)
.ToDictionary()
);


I'll add the MessageBox api to svn.

whoever
22 Nov 2007, 8:35 PM
Thanks for the update. But if this is a manual process, you may think twice before start adding them to your solution. Because similar cases happens all over the place, like when you declare a grid.gridpanel, you won't get prompt for store, columns, viewConfig, renterTo ... ...

It's probably not possible to manually add them all.

yeschoto
26 Nov 2007, 8:16 AM
very good!!!!!!!!

yeschoto
26 Nov 2007, 9:28 AM
ExtJsSharpTest-v1.1.4\ExtJsSharpTest\Web\App_Code\BLL\ProductsBLL.cs
Line 41:


#region Custom Paging-Related Methods
public int TotalNumberOfProducts() {
return Adapter.TotalNumberOfProducts().GetValueOrDefault();

}

return Adapter.TotalNumberOfProducts().GetValueOrDefault();
EVM: MS VS 2005

Teflon
26 Nov 2007, 11:05 AM
Thanks for the update. But if this is a manual process, you may think twice before start adding them to your solution. Because similar cases happens all over the place, like when you declare a grid.gridpanel, you won't get prompt for store, columns, viewConfig, renterTo ... ...

It's probably not possible to manually add them all.

We have to add them manually since the parser only can parse the documented classes, methods, etc. So anything that is left out because its not documented has to be added manually. The parser picks up about 90% of the entire api, the other 10% will need to be put in manually. I have been adding the manual code as I come across it.


ExtJsSharpTest-v1.1.4\ExtJsSharpTest\Web\App_Code\BLL\ProductsBLL.cs
Line 41:


#region Custom Paging-Related Methods
public int TotalNumberOfProducts() {
return Adapter.TotalNumberOfProducts().GetValueOrDefault();

}

return Adapter.TotalNumberOfProducts().GetValueOrDefault();
EVM: MS VS 2005

I'm not clear on what this post means?

ViniciusCamara
26 Nov 2007, 7:32 PM
Congratulations... This example is marvelous!

bwang_dal
28 Nov 2007, 5:39 AM
That's an awesome tool! I am writing Ext code in C# in my current project. Localization is needed in our web application, which means some of localization is going to happen on the client side. That's not a problem for using pure javascript (Extjs), however, by using Ext C#, that's not easy for me. Anyone has any thoughts? Your kind help is greatly appreciated.

Teflon
5 Dec 2007, 10:02 AM
I've updated the parser to parse Ext 2.0 final. I also bundled up the parser and the samples we created. Grab them from the GoogleCode project page.
http://extsharp.googlecode.com/

DragonFist
5 Dec 2007, 11:09 AM
The parser solution fails to load the ExtSharp project with an error that it can't find a resource (which seems to be a project file).

Teflon
5 Dec 2007, 11:41 AM
The parser solution fails to load the ExtSharp project with an error that it can't find a resource (which seems to be a project file).

Do you have Script# v0.4.2 installed on your PC? That may be the problem.

DragonFist
5 Dec 2007, 11:42 AM
don't think so, I'll check.

DragonFist
5 Dec 2007, 12:36 PM
yep, that was it.

saipradeep
6 Dec 2007, 2:38 AM
hi can any one help me!! how to place a label field in the form like TextField?? and i want to display my data in the labelfield for read only purpose. this is like miscField in ExtJS.

another problem is how to use regular expression in textfields for Phone Numbers, zip codes, E-Mails and Url's using Script#.

thanks,
sai Pradeep.

Teflon
6 Dec 2007, 10:43 AM
hi can any one help me!! how to place a label field in the form like TextField?? and i want to display my data in the labelfield for read only purpose. this is like miscField in ExtJS.

The following code will create a read-only TextField that you can place in a form.


TextField name = new TextField(new TextFieldConfig()
.fieldLabel("Name")
.name("Name")
.allowBlank(false)
.readOnly(true) // this config option makes the field read-only
.ToDictionary()
);



another problem is how to use regular expression in textfields for Phone Numbers, zip codes, E-Mails and Url's using Script#.

I have not yet looked at how to approach the Regex problem using Script#. I know it's going to take some tweaking to get an elegant solution. You can just use Script.Eval() for now.

saipradeep
6 Dec 2007, 10:22 PM
Hi Teflon,

Thank you for your reply. yeah for textfield i tried that its working fine. can we place a label field insted of text field?? because i dont want to show that textbox it should be a label.

coming to regular expressions i din't tried Script.Eval() till now!! I will try that now.

any way thank you once again

Regards,
Sai Pradeep.

alexb
10 Dec 2007, 9:42 PM
Hi Teflon,

I had a problem running the 'Hello World' window sample. IE gives a js error and nothing happens in FF.

After some debugging it turned out that parameters passed at runtime to the button JS onclick handler were swapped:
e.g. f(button, evt) -> f(evt, button)

The second issue is typing. The sample uses ButtonClickDelegate(Button b, EventClass evt);
However, when the handler is assigned in C#, it's assigned to an instance of Element

Btw, is there a generic onclick handler with the following signature (object o, EventClass evt)?

Thanks
I used ExtJS2Samples-v2.0.0.zip and ExtJS2Parser-v2.0.0.zip

bookerdog
11 Dec 2007, 1:13 PM
I've been waiting for your implementation of the extjs 2.0 framework and I downloaded the package today. I started playing with the Samples package. There is an error that had to be cleaned up before it would compile.

SampleScripts\menu\ActionsScript.cs


public void init() {
Action action = new Action(new ActionConfig()

Needs to be changed to:


public void init() {
ActionClass action = new ActionClass(new ActionConfig()

alexb
11 Dec 2007, 10:23 PM
bookerdog,

I had the same problem. Copying the final ext 2.0 to the vs.net project folder, reparsing and rebuilding it did the trick

Teflon
12 Dec 2007, 12:30 AM
Sorry for the bad package. I've updated it with everything working correctly out of the box. Go grab v2.0.1 (http://code.google.com/p/extsharp/downloads/list)

alexb
12 Dec 2007, 9:02 PM
The problems I described on the previous page are still there.

Teflon
14 Dec 2007, 9:53 AM
Hi Teflon,

I had a problem running the 'Hello World' window sample. IE gives a js error and nothing happens in FF.

After some debugging it turned out that parameters passed at runtime to the button JS onclick handler were swapped:
e.g. f(button, evt) -> f(evt, button)

The second issue is typing. The sample uses ButtonClickDelegate(Button b, EventClass evt);
However, when the handler is assigned in C#, it's assigned to an instance of Element

Btw, is there a generic onclick handler with the following signature (object o, EventClass evt)?

Thanks
I used ExtJS2Samples-v2.0.0.zip and ExtJS2Parser-v2.0.0.zip

Just from looking at the ExtJS docs, the signature for a button click event is func(Button this, EventObject e) which is how it is specified in the ExtSharp library. I'll take a look at the actual object passed in javascript. Can you post the code you are using to hookup the handler.

There isn't a generic handler for that but you can create your own. You can assign any Delegate to event handlers, just create the delegate like this:

public delegate void MyOnClickDelegate(object o, EventClass evt);
Then you can assign it to a button like this:


new Button(new ButtonConfig()
.text("Save")
.handler(new MyOnClickDelegate(delegate(object o, EventClass evt) {
// do something
}))
.ToDictionary()
);

zakirulq
16 Dec 2007, 8:20 AM
HI,

I am too much excited to see this. I am very much new here. I have tried to findout the source code of your Product.aspx page but did not find anywhere. So would you please help me to get that source code. I think that can help me a lot to work on ext js.

Thanking in advance.

Zaq.

Teflon
16 Dec 2007, 10:48 AM
HI,

I am too much excited to see this. I am very much new here. I have tried to findout the source code of your Product.aspx page but did not find anywhere. So would you please help me to get that source code. I think that can help me a lot to work on ext js.

Thanking in advance.

Zaq.

The code for the sample Products app can be found here (http://code.google.com/p/extsharp/downloads/detail?name=ExtJsSharpTest-v1.1.4.zip) but that code is based on ExtJS v1.1.1. I have not found time to update the app to ExtJS v2.0 but have been doing the samples instead.

mikaelk
18 Dec 2007, 7:47 AM
How I can do A ViewPort With This.
Thanks

Teflon
18 Dec 2007, 8:35 AM
How I can do A ViewPort With This.
Thanks
I've never coded a ViewPort directly so I don't have any sample code to show you, but if you show me the javascript needed to use a ViewPort I could show you how to accomplish the same thing using ExtSharp.

mikaelk
18 Dec 2007, 8:54 AM
I've never coded a ViewPort directly so I don't have any sample code to show you, but if you show me the javascript needed to use a ViewPort I could show you how to accomplish the same thing using ExtSharp.

Thanks
The Javascript code For the ViewPort (with bloc in region center)


<script type="text/javascript">

Ext.onReady(function(){

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var viewport = new Ext.Viewport({
layout:'border',
items:[{
region:'west',
id:'west-panel',
title:'West',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'35 0 5 5',
cmargins:'35 5 5 5',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [{
html: 'ok',
title:'Navigation',
autoScroll:true,
border:false,
iconCls:'nav'
},{
title:'Settings',
html: 'ok',
border:false,
autoScroll:true,
iconCls:'settings'
}]
},{
region:'center',
margins:'35 5 5 0',
layout:'column',
autoScroll:true,
items:[{
columnWidth:.33,
baseCls:'x-plain',
bodyStyle:'padding:5px 0 5px 5px',
items:[{
title: 'A Panel',
html: 'ok'
}]
},{
columnWidth:.33,
baseCls:'x-plain',
bodyStyle:'padding:5px 0 5px 5px',
items:[{
title: 'A Panel',
html: 'ok'
}]
},{
columnWidth:.33,
baseCls:'x-plain',
bodyStyle:'padding:5px',
items:[{
title: 'A Panel',
html: 'ok'
},{
title: 'Another Panel',
html: 'ok'
}]
}]
}]
});
});
</script>

Thanks

Teflon
18 Dec 2007, 9:11 AM
See http://groups.google.com/group/extsharp-discuss/browse_thread/thread/c948cd1e28b18f0?hl=en

mikaelk
18 Dec 2007, 9:17 AM
Thank you very much for you help

bean
18 Dec 2007, 1:56 PM
Hello. I am trying to understand how this project works. After reviewing the sample, it looks like ScriptSharp compiles any custom Ext components you define into a single javascript file (in the case of the example, SampleScripts.js). Is there a way to compile page-specific scripts so as to cut down on unnecessary code being loaded with each page request? The only way I can think of is by setting the Scriptlet's code property to a string conversion of a filestreamreader that opens the component's .cs file. But that wouldnt work because the Ext implementation is in separate files, and thus would not compile under ScriptSharp.

Or, is this issue negligible when considering all the other javascript being loaded? (I am trying to get the best performance out of Ext and ExtSharp :) ).

Teflon
18 Dec 2007, 2:42 PM
Hello. I am trying to understand how this project works. After reviewing the sample, it looks like ScriptSharp compiles any custom Ext components you define into a single javascript file (in the case of the example, SampleScripts.js). Is there a way to compile page-specific scripts so as to cut down on unnecessary code being loaded with each page request? The only way I can think of is by setting the Scriptlet's code property to a string conversion of a filestreamreader that opens the component's .cs file. But that wouldnt work because the Ext implementation is in separate files, and thus would not compile under ScriptSharp.

Or, is this issue negligible when considering all the other javascript being loaded? (I am trying to get the best performance out of Ext and ExtSharp :) ).

Script# compiles all script code within a project into a single js file. You can create seperate projects for page specific scripts so you don't have to load the whole thing for every page. For example, you can have Samples.aspx that references the "SampleScripts" Script# project, and also have MoreSamples.aspx which references the "MoreSampleScripts" Script# project. Just create a new project for each .js file you want.

mikaelk
19 Dec 2007, 7:33 AM
Is there anyone , use this, with AspNet Login provider.

Thanks

reza_62
20 Dec 2007, 5:47 AM
is script# can run on shared host?
thanks ;)

mikaelk
22 Dec 2007, 3:54 PM
How ( with extsharp ) I can do a FORM with a button submit.
thanks.

mikaelk
23 Dec 2007, 5:14 AM
anyone has a example for use extsharp with AjAxPRO
thanks

alexb
26 Dec 2007, 1:45 AM
hello Teflon,

sorry for delay, here is the working code


namespace SampleScripts.window {

public delegate void ClickDelegate(EventObject e, Element o);

public class HelloScript {
private WindowClass _win;

public static void main(Dictionary args) {
ExtClass.onReady(new AnonymousDelegate(delegate() { new HelloScript().init(); }));
}

public void init() {
Element button = ExtClass.get("show-btn");
button.on("click", new ClickDelegate(ShowWindow));
}

private void ShowWindow(EventObject evt, Element button)
{
if (_win == null)
{
_win = new Ext.WindowClass(new WindowConfig()
.custom("el", "hello-win")
.layout("fit")
.width(500)
.height(300)
.closeAction("hide")
.plain(true)

.items(new TabPanel(new TabPanelConfig()
.custom("el", "hello-tabs")
.custom("autoTabs", true)
.custom("activeTab", 0)
.custom("deferredRender", false)
.border(false)
.ToDictionary()))

.buttons(new object[] {
new ButtonConfig()
.text("Submit")
.disabled(true)
.ToDictionary(),
new ButtonConfig()
.text("Close")
.handler(new DOMEventHandler(delegate { _win.hide(); }))
.ToDictionary(),
})

.ToDictionary());
}

_win.show(button);
}
}


Merry Christmas

alexb
27 Dec 2007, 1:33 AM
Hmm, my post was deleted somehow
Anyway, here is the working code


public delegate void ClickDelegate(EventObject e, Element o);

public class HelloScript {
private WindowClass _win;

public static void main(Dictionary args) {
ExtClass.onReady(new AnonymousDelegate(delegate() { new HelloScript().init(); }));
}

public void init() {
Element button = ExtClass.get("show-btn");
button.on("click", new ClickDelegate(ShowWindow));
}

private void ShowWindow(EventObject evt, Element button)
{
if (_win == null)
{
_win = new Ext.WindowClass(new WindowConfig()
.custom("el", "hello-win")
.layout("fit")
.width(500)
.height(300)
.closeAction("hide")
.plain(true)

.items(new TabPanel(new TabPanelConfig()
.custom("el", "hello-tabs")
.custom("autoTabs", true)
.custom("activeTab", 0)
.custom("deferredRender", false)
.border(false)
.ToDictionary()))

.buttons(new object[] {
new ButtonConfig()
.text("Submit")
.disabled(true)
.ToDictionary(),
new ButtonConfig()
.text("Close")
.handler(new DOMEventHandler(delegate { _win.hide(); }))
.ToDictionary(),
})

.ToDictionary());
}

_win.show(button);
}
}



Merry Christmas

Teflon
28 Dec 2007, 3:20 PM
OK, the difference is that you are listening to the click event on a Ext.Element object and not a Ext.Button object. The ButtonClickDelegate signature is is used when the click event is fired by an Ext.Button object. Correct me if im wrong, but I think that when listening to events on Ext.Element, the signature of the event handler is the same as if you attached the event directly to the dom object.

saipradeep
19 Jan 2008, 6:29 AM
Hi,

How to set the grid row style??
i have a grid with some columns depending on the status column the row color should be changed. If 'Active' Green, 'Hold' Red like this.
How to do this??

ds.on(StoreEvents.load,
new StoreLoadDelegate(delegate(Store store, Record[] records, object options)
{
int count = _companyGrid.getColumnModel().getColumnCount();
for (int i = 0; i < count; i++)
{
Record rec = store.getAt(0);
_companyGrid.getView().getRowClass();
}
}),
this, null
);
i am trying like this but no idea how to do!!!!!!
how to set styles for that row??

thanks,
Sai Pradeep

Teflon
19 Jan 2008, 9:13 AM
Have you tried: _companyGrid.getView().getRow(i).Style.Backgroundcolor = "green";

saipradeep
20 Jan 2008, 9:37 PM
Hi Teflon,

Thank you for your quick responce.

yes i tried that it says
'Ext.grid.GridView' does not contain a definition for 'getRow'

is there any problem with version presently i am using script# 0.4.2.0.

thanks,
Sai Pradeep

Teflon
21 Jan 2008, 8:27 AM
Which version of Ext# are you using? try upgrading to the latest version.

saipradeep
21 Jan 2008, 10:18 PM
Hi Teflon,

Presently i am using 1.1 version. ok i will try upgrading to the latest version.

thanks,
Sai Pradeep.

saipradeep
28 Jan 2008, 9:49 PM
Hi Teflon,

I upgraded to the latest version. Its working fine. here is the code

Store ds = CreateOnHoldCmpStore("OnHoldCompanies");
ds.on(StoreEvents.load,
new StoreLoadDelegate(delegate(Store store, Record[] records, object options)
{
int count = store.data.Length;
for (int i = 0; i < count; i++)
{
_companyGridOnHold.getView().getRow(i).Style.BorderColor = "red";
//_companyGridOnHold.getView().getRow(i).Style.Color = "red";
}

}),
this,
null
);

thank u very much.

Here Style.BorderColor is working fine, but Style.Color is not working any idea??

regards,
Sai Pradeep.

saipradeep
28 Jan 2008, 11:22 PM
Hi,

I found the solution for that Style.Color.

in ext-all.css file we should have to modify th following style

.x-grid-cell-text,.x-grid-hd-text {
display: block;
padding: 3px 5px 3px 5px;
-moz-user-select: none;
-khtml-user-select: none;
color:black;
}

remove the color in that tag it workes fine.

thanks,
Sai Pradeep.

marxman
29 Jan 2008, 6:38 PM
-dl

emadomar
29 Jan 2008, 7:03 PM
I have some events on item databound , do you inhert from normal C# Datagrid?

dennis
30 Jan 2008, 12:34 AM
Nice job!
where can I found the php5 code?
thks!

marxman
7 Feb 2008, 7:20 PM
hi ive tried creating a new project so i could start with extjs and script sharp. i copied some samples from the ExtJS2Samples sln and created a class on my new project resembling the class....

but when i run it i got this error:

Microsoft JScript runtime error: 'Ext.DomQuery' is null or not an object

its target file is the ExtSharp.js

need some help.

nammianilkumar
29 Feb 2008, 10:35 PM
hi,
this is anil. how to set the focus on a textfield. so any one having an idea about this. i am using the following code. but it is not working fine.

ExtClass.getCmp("addnote").focus();
or
ExtClass.getDom("addnote").Focus();

please help me...

regards
anil

Teflon
1 Mar 2008, 6:48 AM
hi,
this is anil. how to set the focus on a textfield. so any one having an idea about this. i am using the following code. but it is not working fine.

ExtClass.getCmp("addnote").focus();
or
ExtClass.getDom("addnote").Focus();

please help me...

regards
anil

Is the TextField in a form? I use the following code which works:


Field name = _form.getForm().findField("Name");
name.setValue("");
name.clearInvalid();
name.focus(false);

where _form is a FormPanel.

sreedharp
12 Mar 2008, 3:39 AM
Hi to all,

We developed a website using ScriptSharp 1.1 version. Everything working fine but a problem in Fire Fox. When i click a space bar the page is moving up and having some empty space at the bottom. 5299.

Is there any solution for this to rectify?
Do we need to change css for this?

Please reply me.

devcol
28 Mar 2008, 4:18 PM
Hi guys,

I have worked with Extjs and Script# and have been impressed. I also use ASP.NET AJAX Exposed WebServices and found it tedious to write my Script# classes to interact with them.

So, I started a project up that will generate Script# files based on your web services.

It's a new project so any support and feedback would be much appreciated.

My blog post is here http://devcol.blogspot.com/2008/03/aspnet-ajax-script-webservice-client.html and my project here http://www.codeplex.com/AJAXCodeGeneration

Thanks for reading.

abhinavvohra
10 Apr 2008, 5:58 AM
I have been running into the same issue teflon described a few months ago. The inheritance issue is forcing me to write straight up javascript instead of script#. Has anyone found a workaround?

Anything at this point would help.

Thanks
Abhi

ZeusTheTrueGod
10 Apr 2008, 7:22 AM
I am against any usage of pretranslator , c#/java/etc... to javascript
1st, Intellisence is not so necessary when you have ext 2.0 api documentation
2nd,In firebug you have to look at js and modify js, not script sharp
Also, I guess that javasript itself has all required ability to separate your code in classes, modules, make inheritance,mixins and so on... I prefer to teach the language (js,html,css) instead of learning any buildings like asp.net forms which try to hide it - that's why I am against script sharp as well as all other 'buildings'

Teflon
22 Apr 2008, 6:05 PM
Updated to support ExtJS 2.1.

http://code.google.com/p/extsharp/downloads/list

patambrosio
29 Jun 2008, 7:38 PM
Can somebody link me to a working sample? The sample doesn't seem to work, or is it just me?

I really like to try this, writing ExtJS apps in C# would be a godsend.

A link to a full tutorial would be good too.

Thanks in advance.

extsharp
16 Jul 2008, 11:12 PM
You can see here :http://www.17ext.com/showtopic-25.aspx
(http://www.17ext.com/showtopic-25.aspx)
About extsharp,with images ,written in Chinese


--------------------

There is a Chinese web site , http://www.17ext.com

it provides many extsharp samples and lessons , if your Chinese is well

visit it .

SilentF
20 Jul 2008, 2:46 PM
Hi,
I join patambrosio as I cannot test your sample.

I change the version of nStuff.ScriptSharp.Web from v0.4.5.0 to v0.5.0.0 in the web.config to get the project to launch in a web browser, but all samples are blank from ext# things.

When I try to download the js file link to an example, I got an error saying "file not found".

I just begin in Ext# and I don't understand quite well the exact way it's supposed to work. All I know is that the samples are not exactly "Ready to launch".

Could anyone help me found how to make it work please?

Thanks in advance.

N00be
11 Sep 2008, 6:01 PM
I am trying to compile extjs 2.2 version with this tool and have problems

error CS0234: The type or namespace name 'GridDragZone' does not exist in the namespace 'Ext.grid' (are you missing an assembly reference?)


Has anyone succeeded in generating c# classess for 2.2 version?

MindCore
11 Sep 2008, 6:18 PM
Check out the Coolite Toolkit... version 0.6 will be released next week and it will include version 2.2 for C#. http://www.coolite.com

Teflon
14 Sep 2008, 11:01 AM
I am trying to compile extjs 2.2 version with this tool and have problems

error CS0234: The type or namespace name 'GridDragZone' does not exist in the namespace 'Ext.grid' (are you missing an assembly reference?)


Has anyone succeeded in generating c# classess for 2.2 version?

The new classes are generated but not included in the ExtSharp project. In Solution Explorer, click on the icon to show all files, then right-click on GridDragZone.cs and choose Include in Project. Do the same for any other files with transparent icons.

I went ahead an upgraded svn with extjs 2.2. I had to upgrade the solution to VS2008 as I dont have VS2005 on my machine any longer.

tmcd
11 Oct 2008, 12:16 PM
Hi just stumbled on to this project and downloaded it. Are there any instructions or a getting started guide on how to use this?


thanks for you help,

tom

tmcd
13 Oct 2008, 4:40 PM
hi guys,

I was wondering if anybody could help me out with this. I am trying to create a vista gadget that has a treepanel in it, but cant seem to get it to work. Any help you can provide is appreciated. This is what I have so far

publicstaticvoid Main(Dictionary arguments)
{
GadgetScriptlet scriptlet = newGadgetScriptlet();

TreePanel _treeP = newTreePanel(newTreePanelConfig()
.autoWidth(true)
.root(newTreeNode(newTreeNodeConfig()
.draggable(false)
.id("source")
.text("test")
))
.loader(newTreeLoader(newTreeLoaderConfig()
.dataUrl("http://extjs.com/deploy/dev/examples/tree/get-nodes.php")))
);

_treeP.render(Document.GetElementById("tree-div"));

}

PrajaktaJoshi
26 Nov 2008, 11:14 PM
Hi briandunnington,
You said that you have tried to set up your project...
Can you please explain how did you do it? As I am not very clear with it. I just want to create very basic application, may be it can be just one window.
Can you please help me?
Thanks in advance for the help.

brave_cs
8 Mar 2009, 4:49 AM
Dear All,

i am using ext Script# 2.0 i created asp.net 2.0 script# website and created ext Script# classLibrary,
after that i changed the path of the generated dll files of the class library to be under myWebsite/bin/script, it generates the dll named PageScripts.dll under this location now, but i think that this class library (PageScripts) must generate two javascript files under myWebsite/App_scripts and there names for my example must be PageScripts.js and PageScripts.debug.js, but i am not getting both of these files,

and when i try to run my aspx page that contains this scriptlet

<ssfx:Scriptletrunat="server"ID="scriptlet"EnableDebugging="True"PrecompiledScriptlet="PageScripts.UI.ProductsPage">
<References>
<ssfx:AssemblyReferenceName="sscorlib"></ssfx:AssemblyReference>
<ssfx:AssemblyReferenceName="ssfx.Core"></ssfx:AssemblyReference>
<ssfx:AssemblyReferenceName="ExtSharp"></ssfx:AssemblyReference>
<ssfx:AssemblyReferenceName="PageScripts"></ssfx:AssemblyReference>
</References>
</ssfx:Scriptlet>

it gives javascript error which is PageScripts is undefined. i dont know what is the error exactly, if it is due to javascript non created files or if there is another problem.

please help me asap.

Thanx in Advance,
Haitham Salem

Teflon
10 Mar 2009, 3:53 AM
Shutdown Visual Studio and edit the PageScripts.csproj file in notepad. You'll need to add/edit the following:



<OutputPath>..\Web\bin\Script\</OutputPath>
<ScriptPath>..\Web\App_Scripts\</ScriptPath>



The Debug and Release PropertyGroup tags should look like the following (changes in red):


<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\Web\bin\Script\</OutputPath>
<ScriptPath>..\Web\App_Scripts\</ScriptPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0028, 1591</NoWarn>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\Web\bin\Script\</OutputPath>
<ScriptPath>..\Web\App_Scripts\</ScriptPath>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0028, 1591</NoWarn>
<DocumentationFile>..\PageScripts.xml</DocumentationFile>
</PropertyGroup>

brave_cs
10 Mar 2009, 4:12 AM
Thank You Teflon, Thanx alot it works fine now, i have one question, i found ExtJSApi.dll file in your example ExtJsSharpTest in Web/bin/script. but when i create new ExtJsSharp based website this file is not auto generated, i copied this dll from your example. if i remove it i will not be able to use Ext.Menu, Ext.Layout, etc...

Thanx again
Haitham Salem

brave_cs
10 Mar 2009, 6:54 AM
privatevoid CreateLayout()
{
_layout = newBorderLayoutClass(Document.Body, newDictionary(
"north", newBorderLayoutConfig().split(false).initialSize(70).titlebar(false).ToDictionary(),
"west", newBorderLayoutConfig().split(true).initialSize(200).titlebar(true).autoScroll(true).collapsible(true).collapsed(true).ToDictionary(),
"center", newBorderLayoutConfig().titlebar(true).autoScroll(true).tabPosition("top").ToDictionary()
));
_layout.beginUpdate();
_layout.add("north", new ContentPanel("north", "North", null));
_layout.add("west", new ContentPanel("west", "Navigation", null));
_layout.add("center", newGridPanel(_productsGrid, newGridPanelConfig().autoCreate(true).title("Products").ToDictionary()));
_layout.endUpdate(false);
}

can you lead me teflon to solve this since BorderLayoutClass doesnt Accept Parameters,
Thanx in advance.

Teflon
10 Mar 2009, 9:16 AM
Thank You Teflon, Thanx alot it works fine now, i have one question, i found ExtJSApi.dll file in your example ExtJsSharpTest in Web/bin/script. but when i create new ExtJsSharp based website this file is not auto generated, i copied this dll from your example. if i remove it i will not be able to use Ext.Menu, Ext.Layout, etc...

Thanx again
Haitham Salem

You do not need this dll. It is just left over junk from the old Ext v1.1 sample I made. What do you mean you cannot use Ext.Menu, etc... ?

Teflon
10 Mar 2009, 9:22 AM
I''m not sure what you are trying to accomplish. Here is the Complex Layout (http://extjs.com/deploy/dev/examples/layout/complex.html) example written in c#.

HTML Code:


<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Complex Layout</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../examples.css" />

<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>

<script type="text/javascript" src="../../ext-all-debug.js"></script>

<style type="text/css">
html, body { font: normal 12px verdana; margin: 0; padding: 0; border: 0 none; overflow: hidden; height: 100%; }
p { margin: 5px; }
.settings { background-image: url(folder_wrench.png); }
.nav { background-image: url(folder_go.png); }
</style>
</head>
<body>
<form id="form1" runat="server">
</form>
<ssfx:Scriptlet runat="server" ID="scriptlet" EnableDebugging="True" PrecompiledScriptlet="SampleScripts.layout.ComplexScript">
<References>
<ssfx:AssemblyReference Name="sscorlib"></ssfx:AssemblyReference>
<ssfx:AssemblyReference Name="ssfx.Core"></ssfx:AssemblyReference>
<ssfx:AssemblyReference Name="ExtSharp"></ssfx:AssemblyReference>
<ssfx:AssemblyReference Name="SampleScripts"></ssfx:AssemblyReference>
</References>
</ssfx:Scriptlet>
<div id="west">
<p>
Hi. I'm the west panel.</p>
</div>
<div id="north">
<p>
north - generally for menus, toolbars and/or advertisements</p>
</div>
<div id="center2">
<a id="hideit" href="#">Toggle the west region</a>
<p>
My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
<p>
The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p>
<hr />
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
<p>
Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
<p>
Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
<p>
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
<p>
Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
<p>
Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
<p>
Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
<p>
Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
</div>
<div id="center1">
<p>
<b>Done reading me? Close me by clicking the X in the top right corner.</b></p>
<p>
Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
<p>
Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
<p>
Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
<p>
Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
</div>
<div id="props-panel" style="width: 200px; height: 200px; overflow: hidden;">
</div>
<div id="south">
<p>
south - generally for informational stuff, also could be for status bar</p>
</div>
</body>
</html>


Script# Code:


using System;
using Ext;
using Ext.grid;
using Ext.layout.BorderLayout;

namespace SampleScripts.layout {
public class ComplexScript {
public static void main(Dictionary args) {
ExtClass.onReady(new AnonymousDelegate(delegate() { new ComplexScript().init(); }));
}

public void init() {
Viewport view = new Viewport(
new ViewportConfig()
.layout("border")
.items(new object[] {
new BoxComponent(new BoxComponentConfig()
.custom("region", "north")
.custom("el", "north")
.height(32)
.ToDictionary()),
new RegionConfig()
.custom("region", "south")
.custom("contentEl", "south")
.split(true)
.custom("height", 100)
.custom("minSize", 100)
.custom("maxSize", 200)
.collapsible(true)
.custom("title", "South")
.margins("0 0 0 0")
.ToDictionary(),
new RegionConfig()
.custom("region", "east")
.custom("title", "East Side")
.collapsible(true)
.split(true)
.custom("width", 225)
.custom("minSize", 175)
.custom("maxSize", 400)
.custom("layout", "fit")
.margins("0 5 0 0")
.custom("items", new object[] {
new TabPanel(new TabPanelConfig()
.border(false)
.activeTab(1)
.tabPosition("bottom")
.items(new object[] {
new Dictionary(
"html", "<p>A TabPanel component can be a region.</p>",
"title", "A Tab",
"autoScroll", true
),
new PropertyGrid(new PropertyGridConfig()
.title("Property Grid")
.custom("cloasable", true)
.source(new Dictionary(
"name", "Properties Grid",
"grouping", false,
"autoFitColumns", true,
"productionQuality", false,
"created", DateTime.Parse("10/15/2006"),
"tested", false,
"version", .01,
"borderWidth", 1
))
.ToDictionary())
})
.ToDictionary())
})
.ToDictionary(),
new RegionConfig()
.custom("region", "west")
.custom("id", "west-panel")
.custom("title", "West")
.split(true)
.custom("width", 200)
.custom("minSize", 175)
.custom("maxSize", 400)
.collapsible(true)
.margins("0 0 0 5")
.custom("layout", "accordion")
.custom("items", new object[] {
new Dictionary(
"contentEl", "west",
"title","Navigation",
"border",false,
"iconCls","nav"
),
new Dictionary(
"title","Settings",
"html","<p>Some settings in here.</p>",
"border",false,
"iconCls","settings"
)
})
.ToDictionary(),
new TabPanel(new TabPanelConfig()
.custom("region", "center")
.deferredRender(false)
.activeTab(0)
.items(new object[] {
new Dictionary(
"contentEl","center1",
"title", "Close Me",
"closable",true,
"autoScroll",true
),
new Dictionary(
"contentEl","center2",
"title", "Center Panel",
"autoScroll",true
)
})
.ToDictionary())
})
.ToDictionary());

}
}
}

brave_cs
11 Mar 2009, 12:57 AM
You do not need this dll. It is just left over junk from the old Ext v1.1 sample I made. What do you mean you cannot use Ext.Menu, etc... ?

when i try to import namespaces like "Using Ext; Using Ext.Grid;" i am not able if i removed the ExtSharp.dll from the references. thats why i use it

and i opened the SampleScripts.csproj with notepad that u did upload on http://code.google.com/p/extsharp/ its built on version 2.1, i found that u referenced it here

<ItemGroup>
<Reference Include="ExtSharp, Version=2.0.0.42828, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ExtJS2Parser\ExtSharp\bin\Release\ExtSharp.dll</HintPath>
</Reference>
<Reference Include="sscorlib" />
<Reference Include="ssfx.Core" />
<Reference Include="ssfx.UI.Forms" />
</ItemGroup>


and when i try to remove it raises compilation error as follows :
(Error The type or namespace name 'Ext' could not be found (are you missing a using directive or an assembly reference?).



i am checking the complex Layout source and get back to you if i need any help.

Thanks alot.

Teflon
11 Mar 2009, 7:25 AM
Yes, you must reference ExtSharp.dll.

In your first post you said you were referencing ExtJSApi.dll, which you do not need.

brave_cs
14 Mar 2009, 3:54 AM
dear Teflon,

yes you are right, thank you.

Teflon did you upgrade project named "ExtJsSharpTest" to ExtScriptSharp version 2.1,if you, plz send me a link to download it.

Thnx.

brave_cs
17 Mar 2009, 12:43 AM
Dear Teflon

can you please support me with a link of full tutorial built on the extScript# version 2.1, if you can send the same example "ExtJsSharpTest" built onthis version.

since i have the old one on version 1.1 and i try to use the same example but upgrading it to 2.1 and i face many troubles.

thanx in advance.

heiskanen
6 May 2009, 2:55 AM
Hi,

Is ExtSharp coming for ExtJS 3.x or is there a method to create .dll with existing parser?

Best regards,

Heiskanen

heiskanen
13 Sep 2009, 8:14 AM
Hi,

This is something I just have pulled together.

I took Teflon's original source and modified it little bit to support ExtJS 3.x and created a little gui where user can chance source and destination folders to suit his/her needs.

Also modified how .cs files are created, now parser builds whole VS2008 solution not just .cs files.

This haven't been tested thoroughly (not even closely), althougth I have succesfully used it on my projects, so I would really like to hear if there's something missing from created classes and/or other opinions.

I'm posting now just .exe and screenshot, but I'll post source too after I have cleaned it a littlebit.

And here's quick instructions how to use:
1) Extract .zip file where you wan't
2) Launch .exe
3) Set extjs source folder (src in svn build)*
4) (optional) Set plugins/ux folder (examples\ux in svn build)*
5) Set destination folder where you want VS solution to appear*
6) Hit the Generate button
7) If everything went well open VS solution from destination folder and build it
*These wil be saved to config when user hits Generate button

TODO:
- CleanUP :)
- Add more thoroughly log
- Add treeview where user can browse parsed namespaces/classes/methods etc (and maybe even select classes to parse)
- Add option to build ExtJS source from svn using ExtJSBuilder 2.x before parsing
- Fix bugs...

Hope someone finds this usefull!

Best Regards
Heiskanen

lehighkid
13 Sep 2009, 8:38 AM
Heiskanen,

I am very interested in using and testing your utility however when I attempt to download the attached .zip file it does NOT contain an .exe only a Winzip.Out file. Am I missing something?

Thank you very much for your efforts.

lehighkid

heiskanen
13 Sep 2009, 8:55 AM
Hi,

Just tested it my self and it works OK. I have used Winrar to zip it, but here's same zipped with windows.

Heiskanen

mystix
13 Sep 2009, 5:53 PM
Heiskanen,

I am very interested in using and testing your utility however when I attempt to download the attached .zip file it does NOT contain an .exe only a Winzip.Out file. Am I missing something?

Thank you very much for your efforts.

lehighkid

download using any browser but IE.

mnvraghuram
1 Oct 2009, 12:33 PM
I tried compiling it but failed can any one of u share the complete codeset for this.

heiskanen
1 Oct 2009, 12:46 PM
I tried compiling it but failed can any one of u share the complete codeset for this.

Hi,

I did notice that also. Reason for this is that there is 1 ux component witch namespace overlaps one of the extjs classes.

If you don't set ux folder (parse just extjs components) it should compile OK.

I'm planning to release newer version on this weekend that addresses this and few other bugs that I'v discovered.

Hope this helps,

Heiskanen

williware
2 Dec 2009, 11:03 AM
Great work! Compiled w/ VS2008 without problem for me. Looking forward to trying it out. I had to extract .zip with RAR. That created a file I had to rename to .zip. That file has the .exe in it which I extracted with RAR.

Do you have any sample usage you can post?

Dave

heiskanen
2 Dec 2009, 12:12 PM
Great work! Compiled w/ VS2008 without problem for me. Looking forward to trying it out. I had to extract .zip with RAR. That created a file I had to rename to .zip. That file has the .exe in it which I extracted with RAR.

Do you have any sample usage you can post?

Dave

Hi,

There should be few samples somewhere on this thread or you can download original project from http://code.google.com/p/extsharp/ where there are many samples for you to try.

Beware! I have noticed there are some MAJOR bugs in parser that I'm working to fix (trying to get new release on weekend) and before that you could find parser result somewhat unusefull (ie all the link methods are missing :( ).

- Heiskanen

williware
4 Dec 2009, 5:44 AM
Thanks for the info. Found the samples. If help is needed. Let me know and I will pitch in.

heiskanen
30 Dec 2009, 10:11 AM
Hi,

Finally got time to finish new version to fix old bugs and add some more aquirate parsing and even 1 new feature.

Fixed bugs:
- Parses ext ux sources now without compiler error when compiling parsed result
- Parses now functions marked as @member (Ext.apply etc)
- Readded the morecode folder for adding missing functions etc. that parser can't parse.

New features:
- Added checkbox to define if you really want to create configuration classes that enable you to set config options with intellisense. Checking this will create those classes and IT WILL make parsed JS much larger (also compiling will take much longer :( )!

Hope this helps,

- Heiskanen

PS. Tested on Extjs 3.1 and Script# 0.5.5

williware
30 Dec 2009, 8:37 PM
I'll give it a try over the next few days. Sounds like a good call on the new feature to reduce the size.

albeva
12 Apr 2010, 8:26 AM
bump :P Any updates like extjs 3.2 compatibility?

SeaSharp2
26 Apr 2010, 4:27 PM
As a first step to investigating ScriptSharp I am trying to build a C# library off the 3.2.0 ExtJS version. After 10 or so c# source code tweaks I have a clean compile but the build is failing in a post build event as follows:

error MSB3073: type "C:\extsharptest\ExtSharpAdapter.js" >> "C:\extsharptest\bin\Debug\ExtSharp.js"

I seem to have a copy of Debug\ExtSharp.js already but not the source "Adapter" version. If I remove this this custom build step am I good to go? Is the copy step from ExtSharpAdapter.js some historical artifact?

All done under Visual Studio 2010 btw

Forgot to say I am using the ExtJS --> C# parser referenced on page 18 post 179 in this long thread.

ravikatha
25 Dec 2010, 4:35 AM
Hey guys,

I did similar work for ExtJS 3.3.1. It is pretty much in alpha stage. I request all of you to have a look at it and let me know your feedback.

http://extsharp.codeplex.com/

Thanks
Ravi

KallDrexx
3 Jan 2011, 8:19 AM
Thanks for the link, but I cannot seem to figure out how to use it, to the point of I can't figure out how to use the Ext.OnReady() method. It seems to function differently than the rest of script# (or at least the script# examples I can find).

ravikatha
3 Jan 2011, 10:04 PM
The initial version was crude and mapped the 'Function' type variables exactly to the "System.Function" Script# data type. Upon your query, I tried and figured out that there is no way in Script# to cast a method definition/delegate to System.Function data type.

I hence modified the scripts to change the System.Function type to System.Delegate and uploaded the new build to codeplex. I have also provided a documentation page describing how you can use events in the framework.

Please check it out and let me know if you face any problem.

KallDrexx
4 Jan 2011, 5:36 AM
Thanks for the quick reply! I have some other stuff going on at work atm but I'll try and look at it again by the end of the week :)