Guys I am currently developing a web application, in which rules, which are basically sql queries are obtained from the DB and showed using Jquery sortable. These queries are running based upon a command Sequence (1,2,3) and Status (0,1,2 ..20 ). The command sequence tells you, in which order you have to run . Also the status field is helpful in knowing , whenever an error occurred. It saves the value 1 or 2 ... or 20 , to help identify at which step it stopped. Below I ha开发者_Go百科ve given a UI representation , my problem is that, when the user drags the rules, the cmdSequence and the Status have to updated in DB.
Ref Id RuleNo CmdSequence Status
1 1 1 0
2 2 2 0
3 3 1 1
4 4 1 1
5 5 2 2
6 6 2 2
if i am moving refId 6 before refId 1 then the CmdSequence and Status should be changed. as below ,simillarly drag and dropping in the middle and last
Ref Id RuleNo CmdSequence Status
6 6 1 0
1 1 2 0
2 2 1 1
3 3 2 1
4 4 1 2
5 5 2 2
i want to know how to implement in the server side , while data from browser comes from json.
You will have to detect the change and possibly be making several updates to the database after each user drags a rule up or down.
精彩评论