jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Button click setcellvalue for Selected rows
Tagged: jqxGrid ;, selected rows
This topic contains 4 replies, has 2 voices, and was last updated by dan123 7 years, 7 months ago.
-
Author
-
Hi i have this grid with two price columns, Price 1 and Price 2. Once i have some rows selected, I am trying to setcellvalue to match both the columns whenever i edit in ‘Price 2 column’ and click the submit button to perform the update. Only Price 2 column is editable.
I created a logic but it seems to update only one row. If there is workaround, it will be very helpful.
Example:
Columns Price 1 Price 2
Row 1 $4.00 $4.00 Checkbox checked
Row 2 $3.70 $3.70 Checkbox checked
Row 3 $4.20 $4.20 Checkbox checkedNext
Edited all Rows
Columns Price 1 Price 2
Row 1 $4.00 $1.00 Checkbox checked
Row 2 $3.70 $2.70 Checkbox checked
Row 3 $4.20 $2.20 Checkbox checkedFinal
Next click ‘Submit’ button to match the same values from Price 2 column to Price 1 column based on if checkbox were selected.
Columns Price 1 Price 2
Row 1 $1.00 $1.00 Checkbox checked
Row 2 $2.70 $2.70 Checkbox checked
Row 3 $2.20 $2.20 Checkbox checkedHere is my jsfiddle:
https://jsfiddle.net/UbK74/1385/Ok. Sorry I fixed the above issue.
But now i am trying to figure out something based on the calculations.
I have another grid 2, that basically will be populated by the “Submit” button which will send down my edited value from Price 2 column to grid2 through addrow method. I already created this logic. Also in this grid2 there is a “Delete” button column, to revert back changes to the main grid.I need help with reverting back the “Price 1 and Price 2” values based on the rows i delete from grid2.
For example:
Grid 1: i Edited the values of Row 1 twice, originally it was $4.00
Columns Price 1 Price 2
Row 1 $2.00 $2.00 Checkbox not checkedGrid 2:
Columns Price 2 Delete
Row 1 $1.00 Delete button
Row 2 $1.00 Delete buttonOutput
If i delete Row 1 from Grid 2, it should revert the changes to Grid 1’s both Price 1 and 2 Columns
Grid 2
Columns Price 2 Delete
Deleted Row 1
Row 2 $1.00 Delete buttonGrid 1
Columns Price 1 Price 2
Row 1 $3.00 $3.00 Checkbox not checkedNow if i deleted the last row too from Grid 2.
Final output of Grid 1 will be
Grid 1
Columns Price 1 Price 2
Row 1 $4.00 $4.00 Checkbox not checkedHere is my jsfiddle:
https://jsfiddle.net/xfd7b4ad/11/Hello dan123,
I would suggest you, to just make an array and store in it all the values that you send to the second grid(the original values of the selected rows from the first grid). That way if you want to revert a change from the second grid, you have the original value.
I am sorry if you didn’t get the answer you hoped for. If you have any more questions, please, feel free to ask them here, and I will try to as detailed as possible.
Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/Ok i did what you said kind of using “getrows” method to check for rows with specific firstname. In the example i know its in array and randomly generating firstnames, but this is just for example. So i figured out the problem, but now i am having a different problem where whenever i delete a row from grid 2 its not applying the changes correctly to grid 1 and i cannot seem to delete all rows from grid 2.
Problem: its reverting the changes based on the latest row, deleting all rows from grid 2 not working, and lastly if select all rows from grid 1 to edit and set them to grid 2 as I delete them they are all going to index 1 of grid 1.
So for example: Look at rows that only have different name cause this being randomized so.
Grid 1:
Row 1: $1.00Grid 2
Row 1: $1.00 iF I DELETE THIS ROW, for some reason its applying ‘Row 2’ value to Grid 1 Price columns
Row 2: $2.00Observed:
Grid 1:
Row 1: $3.00if i delete the last row of Grid 2, its using that same value and outputting as
Grid 1:
Row 1: $5.00here is my jsfiddle:
https://jsfiddle.net/xfd7b4ad/34/Hey use this jsfiddle: I updated it
https://jsfiddle.net/xfd7b4ad/40/ -
AuthorPosts
You must be logged in to reply to this topic.