Problem with editor

Problem with editor

ijaukijauk Posts: 2Questions: 1Answers: 1

Link to test case:
Debugger code (debug.datatables.net): igujey
Error messages shown: dataTables.editor.js:3384 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
at Editor._ajax (dataTables.editor.js:3384:10)
at dataTables.editor.js:4560:24
at Editor._event (dataTables.editor.js:3786:17)
at Editor._submit (dataTables.editor.js:4551:10)
at dataTables.editor.js:2923:19
at Editor._event (dataTables.editor.js:3786:17)
at send (dataTables.editor.js:2917:15)
at Editor.submit (dataTables.editor.js:2948:5)
at Editor.action (dataTables.editor.js:6472:22)
at HTMLButtonElement.<anonymous> (dataTables.editor.js:2131:24)
Description of problem:

When I try to use Editor to save data to ms sql server database, following error is thrown:

dataTables.editor.js:3384 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
at Editor._ajax (dataTables.editor.js:3384:10)
at dataTables.editor.js:4560:24
at Editor._event (dataTables.editor.js:3786:17)
at Editor._submit (dataTables.editor.js:4551:10)
at dataTables.editor.js:2923:19
at Editor._event (dataTables.editor.js:3786:17)
at send (dataTables.editor.js:2917:15)
at Editor.submit (dataTables.editor.js:2948:5)
at Editor.action (dataTables.editor.js:6472:22)
at HTMLButtonElement.<anonymous> (dataTables.editor.js:2131:24)

Data is retreived ok, but when i try to insert or update record, above error is thrown.

Here is my server side code:
public ActionResult TablicaPlanRebalans()
{
string? connectionString = _configuration.GetConnectionString("conn");
//var dbType = "sqlserver";
Environment.GetEnvironmentVariable("DBTYPE");

        using (var db = new Database("sqlserver", connectionString, "Microsoft.Data.SqlClient"))
        {
            var response = new Editor(db, "RebalansReport", "Id")
                .Model<PlanRebalansTable>()
                .Field(new Field("Id"))
                .Field(new Field("Pozicija"))
                .Field(new Field("Opis"))
                .Field(new Field("Planirano"))
                .Field(new Field("Rebalans"))
                .Field(new Field("Grupa"))
                .TryCatch(false)

                .Debug(true)
                .Process(Request)

                .Data();

            return Json(response);
        }
    }

And here is my model:
public class PlanRebalansTable
{
public int Id { get; set; }
public string Pozicija { get; set; }
public string Opis { get; set; }
public decimal Planirano { get; set; }
public decimal Rebalans { get; set; }
public bool Grupa { get; set; }
}

This question has an accepted answers - jump to answer

Answers

  • ijaukijauk Posts: 2Questions: 1Answers: 1
    Answer ✓

    I Solved it, thank youy

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Thanks for the update - good to hear you've got it working.

    Allan

Sign In or Register to comment.