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

Editor Inline, input sent empty even he has value in first on edit

$
0
0

Editor Inline, input sent empty even he has value before edit
this wired because i have the same table but with diffrent parmas in other view that working fine with editor inline
in this view when i want to edit, Air_Fare_T.AirFare_Code_T always sent empty on inline edit

i have this serverSide code:

 [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
        public ActionResult GetDataAirFareTrip(int id)
        {
            var settings = Properties.Settings.Default;
            var formData = HttpContext.ApplicationInstance.Context.Request;

            using (var db = new DataTables.Database(settings.DbType, settings.DbConnection))
            {
                var editor = new DataTables.Editor(db, "Air_Fare_T", "Air_Fare_T_Id");
                editor.Where(q =>
                    q.Where("Air_Fare_T.AirFare_Costing_T_Id", "(SELECT AirFare_Costing_T_Id FROM Air_Fare_T WHERE AirFare_Costing_T_Id= " + id + ")", "IN", false)
                );
                editor.Model<ViewModel.AirFareTripEditorVM>("Air_Fare_T")
                   .Field(new Field("Air_Fare_T.Air_Fare_T_Id")
                    .Validator(Validation.Numeric())
                    .Set(false)
                )
                 .Field(new Field("Air_Fare_T.AirFare_Costing_T_Id")
                    .Validator(Validation.Numeric())
                )
                .Field(new Field("Air_Fare_T.AirFare_Code_T").Xss(true)
                .Validator(Validation.Numeric())
                .SetFormatter(Format.IfEmpty(null))
                )
                .Field(new Field("Air_Fare_T.Air_Fare_T_Type").Xss(true)
                .Validator(Validation.Numeric())
                .Options(new Options()
                        .Table("AirFare_Trip_Type")
                        .Value("AirFare_Trip_Type_Id")
                        .Order("AirFare_Trip_Type.AirFare_Trip_Type_Id")
                        .Label("AirFare_Trip_Type_Name")
                )
                .SetFormatter(Format.IfEmpty(null))
                )
                .Field(new Field("Air_Fare_T.Air_Fare_T_Currency").Xss(true)
                .Validator(Validation.Numeric())
                .Options(new Options()
                        .Table("CurrencyCosting")
                        .Value("Currency_Id")
                        .Order("CurrencyCosting.Currency_Id")
                        .Label("Currency_Name")
                        )
                .SetFormatter(Format.IfEmpty(null)))
                .Field(new Field("Air_Fare_T.Air_Fare_T_Price").Xss(true)
                .Validator(Validation.Numeric())
                .SetFormatter(Format.IfEmpty(null)))
                .Field(new Field("Air_Fare_T.Air_Fare_T_PAX").Xss(true)
                .Validator(Validation.Numeric())
                .SetFormatter(Format.IfEmpty(null)))
                .Field(new Field("Air_Fare_T.Air_Fare_T_Total").Xss(true)
                .Validator(Validation.Numeric())
                .SetFormatter(Format.IfEmpty(null)));
                editor.Model<ViewModel.CostingAirlineEditorVM>("Costing_Airlines")
                .LeftJoin("Costing_Airlines", "Costing_Airlines.Airline_Id", "=", "Air_Fare_T.AirFare_Code_T");
                editor.Model<ViewModel.AirFareTripTypeEditorVM>("AirFare_Trip_Type")
                .LeftJoin("AirFare_Trip_Type", "AirFare_Trip_Type.AirFare_Trip_Type_Id", "=", "Air_Fare_T.Air_Fare_T_Type");
                editor.Model<ViewModel.CurrencyCostingEditorVM>("CurrencyCosting")
                .LeftJoin("CurrencyCosting", "CurrencyCosting.Currency_Id", "=", "Air_Fare_T.Air_Fare_T_Currency");

                // Post functions
                editor.PreCreate += (sender, e) =>
                {
                    var totalVal = getTotalValTrip(e.Values, id);
                    editor.Field("Air_Fare_T.Air_Fare_T_Total").SetValue(totalVal[1]);
                    editor.Field("Air_Fare_T.Air_Fare_T_Price").SetValue(totalVal[0]);


                };
                editor.PreEdit += (sender, e) =>
                {
                    var totalVal = getTotalValTrip(e.Values, id);
                    editor.Field("Air_Fare_T.Air_Fare_T_Total").SetValue(totalVal[1]);
                    editor.Field("Air_Fare_T.Air_Fare_T_Price").SetValue(totalVal[0]);


                };
                editor.Process(formData.Unvalidated.Form);
                DtResponse data = editor.Data();
                return Json(data, JsonRequestBehavior.AllowGet);
            }
        }


Viewing all articles
Browse latest Browse all 81728

Trending Articles



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