Skip to content

Conversation

@bak-t
Copy link

@bak-t bak-t commented Dec 7, 2015

General description

Fixed:

  • serialization of ColDef.MRenderFunction property in DataTableConfigVm.cs (now it's possible to use any JavaScript expression in its value);
  • reference to EmbeddedResourceVirtualPathProvider in Mvc.JQuery.Datatables.Example.csproj.

Refactored DataTableConfigVm.ConvertColumnDefsToJson to simplify adding serialization of new ColDef properties.

MRenderFunction property issue

According to DataTables documentation it's possible to specify function or string for rendering particular column. Before the fix when setting MRenderFunction like this:

var customColumn = new ColDef(){
  MRenderFunction = "'MyComplexProperty.NestedValue'"
}

You'll get something like:

{"mRender":\u0027MyComplexProperty.NestedValue\u0027,"aTargets":[5]}

Similar thing with double qoutes.
This behavior is caused by usage of JavaScriptSerializer & tricky double quotes trimming.

 - serialization of ColDef.MRenderFunction property in DataTableConfigVm.cs (now it's possible to use any JavaScript expression in its value);
 - reference to EmbeddedResourceVirtualPathProvider in Mvc.JQuery.Datatables.Example.csproj.

Refactored DataTableConfigVm.ConvertColumnDefsToJson to simplify adding serialization of new ColDef properties.
mcintyre321 added a commit that referenced this pull request Dec 8, 2015
ColDefs serialization fix & refactoring.
@mcintyre321 mcintyre321 merged commit 59e84e3 into mcintyre321:master Dec 8, 2015
@mcintyre321
Copy link
Owner

People can still use named functions for MRender, right?

@bak-t
Copy link
Author

bak-t commented Dec 8, 2015

Yes.
If someone write (C#):

col.MRenderFunction = "myCustomRender"

he or she would get (JavaScript):

{"mRender":myCustomRender, ...}

in rendered view

@mcintyre321
Copy link
Owner

Coolio :)

On 8 December 2015 at 13:05, Tymur Baksheyev notifications@github.com
wrote:

Yes.
If someone write (C#):

col.MRenderFunction = "myCustomRender"

he or she would get (JavaScript):

{"mRender":myCustomRender, ...}

in rendered view


Reply to this email directly or view it on GitHub
#138 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants