Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

How to pass string array in AdditionalParameters response? #54

Open
Tegawende opened this issue Apr 16, 2017 · 1 comment
Open

How to pass string array in AdditionalParameters response? #54

Tegawende opened this issue Apr 16, 2017 · 1 comment
Assignees
Labels
bug Decribes a bug or an invalid behavior from the library enhancement Describes an enhancement or an existing feature
Milestone

Comments

@Tegawende
Copy link

Hello,

I want to return additional parameters from my controllers.
I enabled the response parameters according to what you said in other thread.
My question is about the parser function.
How can I write my parser function if I want to return a string array?

Sorry for my bad english.
Thanks !

@bogusz
Copy link

bogusz commented Jun 13, 2017

Hi,

I had similar problem just few minutes ago (Dictonary as additional parameter value). The problem is that in ToString() method of DataTablesResponse class writes additional parameters like this: jsonWriter.WriteValue(keypair.Value);

I wanted to override this behavior, but DataTablesResponse can not be inherited, because of private constructors..

So, I copied the DataTablesResponse class implementation to my own DataTablesResponseExtended class and use this code to write addidtional parameters:

foreach (var keypair in AdditionalParameters)
{
    jsonWriter.WritePropertyName(keypair.Key, true);
    if (keypair.Value is IEnumerable)
    {
        jsonWriter.WriteRawValue(SerializeData(keypair.Value));
    }
    else
    {
        jsonWriter.WriteValue(keypair.Value);
    }
}

@ALMMa ALMMa self-assigned this Jun 17, 2021
@ALMMa ALMMa added bug Decribes a bug or an invalid behavior from the library enhancement Describes an enhancement or an existing feature labels Jun 17, 2021
@ALMMa ALMMa added this to the 3.0.0 milestone Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Decribes a bug or an invalid behavior from the library enhancement Describes an enhancement or an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants