Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82402

Getting action type in server

$
0
0

Hi

I have the code below to try and grab the action from editor. But when 1st loading the datatable, the code inside editor.Validator does not get hit and so actionType always returns null when I believe DtRequest.RequestTypes.DataTablesGet should be returned. Editor seems to do a 2nd pass and returns action = DataTablesGet. The same goes for EditorCreate and EditorUpload. Is there a better way to grab the current action being done by editor (create, remove,...) rather than via a validator?

    public static DtResponse CRUDCDRDataAndFiles(int intCdrFrmtSrc, int intCdrFrmtTpe, string strCdrFrmtNme, CDRDataUISettings lblo)
    {
        Editor editor = null;         
        DtRequest.RequestTypes? actionType = null;

        HttpRequest formData = System.Web.HttpContext.Current.Request;                

        using (Database db = new Database(SetGetDbType2, SetGetDbConnection))
        {
            editor = new Editor(db, "AutoCDRFiles").Model<CDRDataDBModel>();
            editor.Validator((editor1, action, data) =>
            {
                actionType = action;
                return null;
            });
            editor.Field(new Field("id")
                .Set(false)
            );

            if (actionType != DtRequest.RequestTypes.EditorUpload)
            {
            ...
            }

            editor.TryCatch(false);
            editor.Debug(true);
            editor.Process(formData);
            editor.Data();
        }
    }

Viewing all articles
Browse latest Browse all 82402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>