logging editor
logging editor

I wanted to add something to my logging so that could quickly see at a glance what the actual changes to the data were.
so now i need to get the previous values from editor before i check what has changed and save in my log table
here is my code
editor.PreEdit += (sender, e) => prev_Values = Common.Classes.Functions.getPrevValues(db, editor.Table()[0], "MealService_id", e.Id);
and this is the prev_values function:
public static Dictionary<string, object> getPrevValues(DataTables.Database db, string table,string tablePk ,object id)
{
IEnumerable<string> st = new List<string>() { "*" };
Dictionary<string, dynamic> check = new Dictionary<string, dynamic>();
check.Add(tablePk, id);
prev_Values = db.Select(table, st, check, null).Fetch();
return prev_Values;
}
now until here its ok. but i get only the data from specific table, and not all the data from join tables,
how i can get this data?
This discussion has been closed.
Answers
Hi,
You'd need to perform the join against your other tables in addition to your
select
if you are pulling in and changing information in other tables. Or are you just changing the reference value to them in the host table?Allan
so i need to write this function to every table, it cannot be generic?
for now i changing the reference value in my tables,
hey allan one more question about other subject, about export to excel all working great but there are columns thats show me object object when multiple value in column, how can i show all values and not object object?
How generic it can be will depend on how you are storing the data. If you have a look at this example we serialise the changed values and just store that in the db. If you wanted to break it down so you have a per column value, then yes, it would need to be per table.
That suggests that the data property for the cell points to an object (or array). Buttons' export should use the display value by default (although perhaps you are using an object for that?). You can use an orthogonal data renderer to control what is exported. To be able to help much more than that, I'd need a link to a test case showing the issue.
Allan
thank Allan, i have one more question if you can help!
i have tables called hotel, contactMan and ContactMan_Hotel, each hotel can have many Contact Man.
i want to add option in form in create mode of hotel to able to add rows automatic(contact man row)when click on custom button +,
the rows will be need to be with identity number so when i will insert them into database i could run over with for i and insert all..
this is simple without editor, but i get stuck with editor
Do you mean you want a list of managers and the ability to add new ones in the form? I'm afraid that is not something that Editor currently does.
I'm not certain that is what you are actually asking though. If you just want to link managers to hotels, then the Mjoin example shows how that can be done.
Regards,
Allan
if i have hotel and mjoin to contact man table
can i add manager to this table from the hotel form?
because it simply insert first the hotel details and then go to contact man table and create the contact man?
i just want to have the ability to add bulk of row every time i press button + on form, then in server-side i will take the information with for i loop and will handle this myself?
I'm really sorry, I'm just not understanding what you are looking for. Are you able to illustrate it with data or with wireframe pictures?
Thanks
Allan
i do something else, but i get stuck.
this is my way:
but now i cant get the contact_man details i get timeout exception, maybe beacuse the editor database is still using this table?
I'd expect the server to give an error stating that there was already a lock on the database if that was the case. Its locking up somewhere in that code, but its not clear to me where. If you remove your
PostCreate
event handler, does it run through?Thanks,
Allan