Error using Options.Add() function

Error using Options.Add() function

ITAppData@HomeStreet.comITAppData@HomeStreet.com Posts: 66Questions: 17Answers: 2

I have the following code designed to pull in a list of employees:

                        editor.Field(new Field("REFERRAL.Referee_EmployeeID").SetFormatter(Format.NullEmpty())
                            .Options(new Options().Table("EMPLOYEE").Value("EmployeeID").Label(new[] { "FirstName", "LastName", "EmployeeID" })
                            .Render(row => string.Format("{0} {1} ({2})", row["FirstName"], row["LastName"], row["EmployeeID"])).Add("No Referee", null)));

I am attempting to use the .Add functionality to add a custom static option as per the following documentation:

https://editor.datatables.net/manual/net/options#Add()

However when doing so I receive the following error:

Not sure if I'm using this incorrectly or if there is something else wrong.

Thanks for any assistance, let me know if I can provide additional information.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 64,010Questions: 1Answers: 10,554 Site admin
    Answer ✓

    Hi,

    I'm afraid you've found an error in the changes I made for the Options in Editor 2.2 there. The intention had been for the manually added options to be passed through the label renderer, but that isn't suitable in this case since you already have the label and value, they just need to be added!

    I've committed a fix that will address this. You are welcome to build the dll form that repo, or I can send you an updated dll if you like? I suspect it will be 2-3 weeks before the next patch release of Editor (this is the first change since 2.2.1).

    Thanks for letting me know about this error.

    Allan

  • ITAppData@HomeStreet.comITAppData@HomeStreet.com Posts: 66Questions: 17Answers: 2

    Hey @allan,

    As always thanks for the quick response :smile:

    If you wouldn't mind sending me the updated DLL that would be great. Currently using .NET 4.7

  • ITAppData@HomeStreet.comITAppData@HomeStreet.com Posts: 66Questions: 17Answers: 2
    edited February 11

    Hey @allan,

    As a follow up, I attempted to build the DLL on this and am receiving the following error:

    ##\Options.cs(79,24,79,27): error CS0161: 'Options.Add(Dictionary<string, object>)': not all code paths return a value
    

    Added the

    return this;
    

    on that one to resolve, but not sure that's what you would want there or not :smile:

  • allanallan Posts: 64,010Questions: 1Answers: 10,554 Site admin
    Answer ✓

    Doh! Fixed now (not certain why it compiled for me with that error, but yes, that change is needed).

    I'll PM you with the dll I've built.

    Allan

Sign In or Register to comment.