jqgrid delete row only on screen and save the deleted row - jqgrid

I'm using jqgrid with inline editing , when the user gets to the last cell inside a row , when he clickes on "tab" key he will be editing the next row - and if it does not exist a new row will be created.
I want to add a delete row function for the user , but still to have that row data inorder to send it later to the server as a deleted row.
I tried hiding the row , but then when the user "tabs" to the next row - it goes to the hided row - and i want it to go only to the not hided rows.
Is there a way to mark a row as deleted? and then when I generate the xml from the grid rows it will be a part of those rows? or is there a way to delete the row and save it's cells values , and be able to navigate throgh the grids line without going throgh the deleted line?
Any help will be appritiated!
Thank's In Advance.

To fix problem with editing of hidden row you can try to add class "not-editable-row" to the row which you hide.
$("#"+rowid).addClass("not-editable-row").hide();
If it will not help you will have to overwrite the default "TAB" behavior of jqGrid (see the question for implementation details)
Probably more easer way would be to use delRowData which delete a row from the grid without sending any information to the server. If you want to have your custom implementation of the "Delete" button in the navigator (see the example here). Inside of your onClickButton event handler you can save the contain of rows, which will be deleted, to some JavaScript array/object and then delete the row with respect of delRowData. So you can trace all delete operation, save deleted rows and send later all needed informations to the server.

Related

How to save only change data in jqgrid?

I'm using jqgrid.
When the user execute (add/change/delete) rows more than often, and some documents have hundreds of rows.
If a user clicks the Save button, all rows (including no changed rows) are updated at once and it takes a while when rows are in the hundreds.
I just want to update the changed data only.
Is there any row status check function?
To verify whether the data has been changed or not during editing you can use the internal jqGrid option savedRow:
var row = $("#yourGrid").getGridParam("savedRow"); to get the data.
According to the documentation:
The array savedRow (option in the grid) is filled with the values before the editing. This is a name:value pair array with additional pair id:rowid
After the row is saved or restored the editable attribute is set to “0” and the savedRow item with id=rowid is deleted

Jqgrid - How to create a custom add-button that you can supply of parameters

When you create a jqgrid there is a default button on the bottom of the grid that allows you to create new records.
However, when you open the modal, all input fields are empty.
In my situation I need this button, but I also need the exact same thing but with the possibilty of adding a few parameters so some of the fields are already filled in. The parameters would come from the selected row at that moment.
Like when I click a row where the date is set to 01/01/2099 i need the add-modal to open with the date already set to that date.
You can use beforeShowForm or afterShowForm to make any changes in the Add Form during opening. For example you can read the values from currently selected row and fill some fields of the form with new values. To be open Add form on click or double-click on the row you need just call editGridRow inside of onSelectRow/ondblClickRow callback.

How to add rows with values already predefined?

In Oracle APEX I have a tabular form that returns one row and has cancel, delete, submit, and add row buttons. When I click the add row button it adds an empty row to the form but I would like it to add a new row with certain columns already filled in containing the same data as the first row. I was thinking I'd have to add a PL/SQL process to the page. How would I go about doing this?
You could set the default value for each column in the report to be based on the value of a hidden item (a hidden item per column) and set the values of these hidden items in a page load process by running the same query that populates the first row of the report.

Slickgrid 2.1 - Apply and Remove Formatters On The Fly (i.e., Depending on Runtime Conditions)

I'm using slickgrid 2.1 and successfully using a formatter for one of my columns in order to display a button that, when clicked, deletes the corresponding row from the grid.
My requirements and question: I need to only display this button in the row the user single-clicks on. When the user clicks one row, then another, the button from the first selected row needs to be hidden and the button on the second selected row needs to be displayed. How can I programmatically do this?
Many thanks.

Is there a way to force a single row refresh with SlickGrid?

I have the amazing SlickGrid configured to access data asynchronously and post user changes back to the server asynchronously. In general terms, the server may modify a few fields of a row based on the user's changes. As such, after the row is updated I would like SlickGrid to refresh only that row without changing the rest of the view.
Does anyone know how to do this?
In my case, the field that changes on the server is a timestamp associated with the record that is updated by a database trigger. If the timestamp is out of date, the user has an old copy of data, and if they submit changes, they may overwrite a new copy. Since I can't find a way to trigger a refresh, the user cannot modify their own changes without refreshing the browser window (forcing a complete refresh).
You should be able to do this using grid.invalidateRow() and grid.render(). SlickGrid will re-render the affceted rows (assuming they are displayed in the currently visible viewport) without refreshing the entire page.
// Mark row 42 as changed and re-render the display
grid.invalidateRow(42);
grid.render();
For an example check out SlickGrid Example 14. (Click the Start Simulation button to see it in action)
function updateSlickgrid() {
dataView.setItems(tableName);
grid.invalidate();
}
Note : tableName could be the array or id etc.
I prefer storing all the slickgrid data in the array ex tableName = [];
Keep using the above function when it comes to displaying the data in slickgrid

Resources