ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Getting data of existing Grid group row when dropping another row on it
Title:
B
I
{code}
?
I'm dropping grid rows from one grid to another. The grids have grouping. I have to update some properties of the dropped row data based on under which group it is getting dropped to. I need to see in which group the row is getting dropped in grid. Can I get the data of the row which is replaced ? Currently I am getting values from only the row which was previously there before getting replaced. Code: @(Html.Awe().Grid("TestGrid") .Url(Url.Action("GridGetItems", "Test")) .Mod(o => o.Loading().AutoMiniPager().MovableRows()) .Columns( new Column { Bind="Id", Width = 80, Resizable = false, Hidden=true }, new Column { Bind= "Name", Sort = Omu.AwesomeMvc.Sort.Asc, Width=130 } )) <script> $(function () { $("#TestGrid").on("awedrop", function (e, data) { var row = $(e.target); console.log("utils.model ", utils.model(row), " data ", data, " data.previ ", data.previ); }); }); </script>
Save Changes
Cancel
Sam Mosaic
asked at 17 Nov 2023
Answers
B
I
{code}
?
The row on which you're dropping is not getting replaced, a new row is placed between 2 rows, or before/after 1 row when it is first/last, the group header doesn't have `.awe-row` class, so you could do something like: $("#gridId").on("awedrop", function (e, data) { var row = $(e.target); var prev = row.prev(); var newGroupRow; if (prev.length && prev.is('.awe-row')){ newGroupRow = prev; } else { newGroupRow = row.next(); if (!newGroupRow.length) { return; // drop on empty group/grid } } console.log(utils.model(newGroupRow)); });
Save Changes
Cancel
Omu
answered at 18 Nov 2023
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK