Let's say I have a grid for orders. Each order is linked to a customer. I'm using RubyOnRails server and I probably don't use SmartClient 100% optimal for "belongs to" relationships.
The scenario I'm describing is not 100% the actual situation, but it should clarify the issue I'm facing right now.
In the grid, I show the customer's name which is retrieved together with the order details. The SmartClient RestDataSource (and grid) treat the customer_name as field of the Order model. The SQL to retrieve this order would be something like:
I want the user to be able to edit the customer's name directly from the orders grid. To the server the field "customer_name" is posted and there - with some trickery - I save the name of the customer via a Customer model.
If the customer name is left empty, a validation error occurs and the server returns that error on the "name" field, because the customer model knows the field by its name "name" (not "customer_name"). The error is not shown in the grid, because that only knows "customer_name". I fixed this by changing (server-side) the object returned by the server to set the error on the "customer_name" field. Now the error icon shows in the grid, but when I hover it, an error in the console occurs. Further debugging shows the error string is null and therefore the asHTML() method can't be fired. A bit difficult to send screen dumps of everything so I try to formulate a concrete question.
Is it possible to catch the moment the data gets returned (thus when the saving failed)? And can I then set the error client side? This way the server doesn't need to the trickery of changing the error field name and can I have this specific grid to do what it needs.
Hopefully this explains the issue.
The scenario I'm describing is not 100% the actual situation, but it should clarify the issue I'm facing right now.
In the grid, I show the customer's name which is retrieved together with the order details. The SmartClient RestDataSource (and grid) treat the customer_name as field of the Order model. The SQL to retrieve this order would be something like:
Code:
SELECT orders.*, customer.name AS customer_name FROM orders INNER JOIN customers ON customers.id = orders.customer_id
If the customer name is left empty, a validation error occurs and the server returns that error on the "name" field, because the customer model knows the field by its name "name" (not "customer_name"). The error is not shown in the grid, because that only knows "customer_name". I fixed this by changing (server-side) the object returned by the server to set the error on the "customer_name" field. Now the error icon shows in the grid, but when I hover it, an error in the console occurs. Further debugging shows the error string is null and therefore the asHTML() method can't be fired. A bit difficult to send screen dumps of everything so I try to formulate a concrete question.
Is it possible to catch the moment the data gets returned (thus when the saving failed)? And can I then set the error client side? This way the server doesn't need to the trickery of changing the error field name and can I have this specific grid to do what it needs.
Hopefully this explains the issue.
Comment