Hello I am still looking to get the hang of Editor and Datatables I am trying to set up a master- details view of which seems to work to some extend. The issue is when I try to add a detail record I am not able to pass the master Rec id for the link. I looked at join tables but I am a bit confused.
Provide a bit of guidance.
see the pictures
Masters record (picture MasterRecord) Provides the sumary of the Table with an Activity Button.
When click the activity Button open "Editor" create screen see (Details Pic).
I enter the information and it doesnt give an error but it doesn't save. The code for my server side code is the following:
public ActionResult ActRec()
{
// DtRequest request = HttpContext.Request;
var settings = Properties.Settings.Default;
using (var db = new Database(settings.DbType, settings.DbConnection))
{
var response = new Editor(db, "SaActivity", "ActID")
.Model<saActRec>()
.Field(new Field("ActivityType")
.Validator(Validation.NotEmpty())
)
.Field(new Field("ActDate")
.Validator(Validation.DateFormat(
Format.DATE_ISO_8601,
new ValidationOpts { Message = "Please enter a date in the format yyyy-mm-dd" }
))
.GetFormatter(Format.DateSqlToFormat(Format.DATE_ISO_8601))
.SetFormatter(Format.DateFormatToSql(Format.DATE_ISO_8601))
)
.Field(new Field("Contact")
)
.Field(new Field("Reference")
.Validator(Validation.NotEmpty())
)
.Field(new Field("Notes")
)
.Field(new Field("SalesOpId")
)
.Process(Request.Form)
.Data();
return Json(response);
}
//JQuery for the "Add Activity"
$('#MyTable').on('click', '#AddAct', function () {
var tr = $(this).closest('tr');
console.log(tr)
editor1
.buttons({
label: "Save",
fn: function () { this.submit(); }
})
.edit(tr);
});
Please help if you could point me in the right direction.