How to...

32 views
Skip to first unread message

rekna

unread,
Nov 5, 2009, 4:25:34 PM11/5/09
to Scriptsharp
A discussion about who to write some coding constructs in Scriptsharp

eg. one I've been looking for quite a while, was

$(document)

which can apparently be written as:

jqProxy.jQuery(typeof(Document))

Jquery proxy class definition:

[GlobalMethods]
[Imported]
[IgnoreNamespace]
public static class jqProxy
{
[PreserveCase]
public static jQuery jQuery(object obj)
{
return null;
}
}

a jQuery class implementation can be found on JQuerySharp.codeplex.com
(it's not mine), but you'll need to have the above definition of the
static jQuery method on the proxy class with parameter object, to be
able to use typeof(Document) as parameter.

rekna

unread,
Nov 21, 2009, 12:16:15 PM11/21/09
to Scriptsharp
To make you browser redirect to some other page from script:

Windows.Location.Href = "some url";

rekna

unread,
Nov 21, 2009, 12:31:33 PM11/21/09
to Scriptsharp
Extending jquery object with plugins: inherit from jquery object

[IgnoreNamespace]
[Imported]
public class JQGrid : jQuery
{
[PreserveCase]
public object setGridParam(Dictionary options) { return
null; }
}

you can write now :


public void Test()
{
JQGrid grid = (JQGrid)jqProxy.jQuery("#grid"); //cast to grid,
all methods from jQuery still available
//on JQGrid,
since it is inherited
grid.setGridParam(new Dictionary("hoverrows",false)); //
jQrid method
grid.toggleClass("ui-something"); //
jQuery method
}
Reply all
Reply to author
Forward
0 new messages