Hi, guys!

I've got a table with some records and need to be able to move them up or down, as well as I need to organize them according to each one's priority.

I'm using web block and events to do so.

I also have an attribute "Ordem", Order in English, that saves the position of an item on the list.

I believe the logic is right as I've seen while debugging the application and the variables show the expected results. However, nothing seems to happen even though I refresh the table data.

I'm not allowed to share the information because it contains sensitive data.


To try to explain better:

On my logic I get the current position when click on the button on the wanted row. This is saved on a variable. I have an auxiliary variable to store this info too. And another one to store the row above/ below.

By clicking to move up, the current position receives the positiov of the row above. And the row above receives the data stored on the auxiliary - the old current position.

The problem is that even if the values of the variables change, the table doesn't change.



Hope I've been clear so that you can help me (:


Best regards,

Eduardo Coelho

Hi Eduardo,

As far as i understood you are able to change the values of the variable but are commiting those changes in DB or data source as well? second is sorting order defined by this column values? Please double check and let us know because if values changes in DB or data source your list must be sorted according to them.

Regards,

Manish

Hi, i don't know if I understand.. but you are using refresh data and ajax refresh to update the table on the screen?


Try this..

Hi,

As I understood, you are not saving in database, just in memory, right?

If so, you need to pay attention if you are updating the column "Ordem" in TableRecord component or in Aggregate (TableRecord's source). If the first case, when refreshing, the TableRecord will get the Aggregate content again, losing your changes. To prevent this, you need to update the GetTable.Current.TableName.Ordem attribute (consider RowNumber).

Solution

Hi Eduardo,


You need to use the index of the list to handle this in two steps.

1. change the order value of the list

2. Sort on order

Please have a look at the attached OML.


Do let me know if this helps.

Regards,

Saugat

Solution

Hi, guys!

I was not saving at the database. Thank you all for helping me and fast replying.

I haven't achieved the solution yet, but now I know what I was doing wrong and will try to get this id's and save the operation at the database.


Best regards,

Eduardo Coelho