Hi,
I am using WebDataGrid (vol 12.1) in my project. I basically list the files present in a folder inside the grid. I also have an option to delete single / multiple file(s). When i select and delete a file, i am just hiding that row. All of this is done in client-side. I have enabled Batch Updates
<Behaviors> <ig:EditingCore AutoCRUD="False" BatchUpdating="True"></ig:EditingCore> <ig:Selection CellClickAction="Row" RowSelectType="Multiple"></ig:Selection></Behaviors>
I am not able to delete multiple rows at a single go. For example, in the grid i have 7 rows, and i select 3 rows to be deleted and i click on "Del" button. Instead of deleting 3 rows, it is deleting only 1 single row. The code i have written in client-side for "Del" button is shown below
var grid = $find("WebDataGrid1");var selectedRows = grid.get_behaviors().get_selection().get_selectedRows(); for (var j=0; j< selectedRows.get_length();j++) { grid.get_rows().remove(selectedRows.getItem(j), false); }
After clicking on the "Del" button, i am able to get the count as 3. After removing the first row, the selectedRows.get_length() becomes 0. What could be the problem? Can we delete multiple rows in the grid in client-side? If so How? I am converting my UltraWebGrid to WebDataGrid.
Thanks,Raja.
Hello cadcame,
Thank you for posting in the community.
You can use thedeleteRowfunction of the RowDeleting behavior in order to delete multiple rows while batch updating is enabled. For instance:
Attached is a small sample illustrating this scenario.
Please let me know if this helps.
Hello Petar,
Thanks for the reply. I tried your example and it worked for me. But this is not what I am looking for. My requirement is that I will display a list of files that is stored in a folder by the user in my server. I have a 3rd party control named xupload. I also have "Add", "Delete" and "Save" button. Using "Add" button, the user can add files from the client side and while adding a row in the grid, I am also adding it to the Upload control list. If I select multiple files and I click on "Delete" button, I will just remove the row in the grid and also remove those files from the Upload control in the client side itself. When I click on "Save" button only the filenames and their corresponding path that is stored in the Upload control will be uploaded to the server. The grid control is for Display purpose only.
Now in the example that you have provided, when I select multiple files and click on "Del" button, the row are getting deleted in the grid but when I click on the "Save" button, I am getting an Async postback error. I found out that since I have selected "RowDeleting" option in the batch update, it is expecting a postback for the rows that is deleted in the grid. I don't want that to happen. When I delete multiple files in the client-side, I expect no postback to happen for the grid. When I delete a single row in the client-side, and when I click on "Save" button I am not getting an error and the file is uploaded to the server. Now it would be very helpful if I am able to delete multiple rows in the client side without any postback. Is there a solution for this?
Thanks,
Raja.
Hello Raja,
Thank you for your reply.
WebDataGrid does not currently support purely clientside CRUD operations (in order to reflect the changes the grid needs to update on the server).
Therefore I would suggest that you use ourjQuery igGridinstead:
http://es.infragistics.com/products/jquery/sample/grid/editing
Please do not hesitate to contact me if you have any questions.
Please send me anu Zip File
this url was not working sir.
Hi ,
How do I clear WebDataGrid at client side, instead of deleteing all row using loop
-Rohan
Glad that the issue seems to be resolved.
Please do not hesitate to contact me if any questions arise.
Sorry for the late reply as i was busy in another project. i found out the reason the Asyn errors occurs was during postback i am not binding the grid and the grid expects it. So i stored the Dataset in a session variable and then in postback just binding the grid to the session variable. Now i am able to add (or) delete a file in the grid.
As for your suggestion for using jquery Grid, let me check it