facing issue while moving rows of telerik radgrid up or down
I have radgrid which has some controls like raddatepicker, textbox & combobox in eachrow.
I want to give option to user to move complete row up or down on click of arrow in that row only.
I am writing below code to resolve my purpose. Code is working fine except the IDs of controls do not change on moving the rows and thus sometimes the controls value is set blank if correct id is found else not.
Is there any other way to set the corrosponding row controls to blank instead of finding the ID of that control?
Please help, I am stuck on this issue.
- function pageLoad() {
- $(".up,.down").click(function () {
- var index = $(this).closest('tr')[0].rowIndex - 1;
- var $row = $(this).parents("tr:first");
- var datarow = GetGridData();
- var scheddate = datarow[index].findElement("rddateScheduleDate").id;
- var schedtime = datarow[index].findElement("txtSchTime");
- if ($(this).is(".up")) {
- if ($row.prev().length != 0) {
- // Clear date & time
- $find(scheddate).clear();
- $(schedtime).val('');
- $row.insertBefore($row.prev());
- }
- else {
- alert("Cannot move Up");
- return false;
- }
- }
- else {
- if ($row.next().length != 0) {
- // Clear date & time
- $find(scheddate).clear();
- $(schedtime).val('');
- $row.insertAfter($row.next());
- }
- else {
- alert("Cannot move down");
- return false;
- }
- }
- });
- }
-