Batch insertion of Rows - iphone

i read about Batch insertion and deletion of rows in the apple documentation,but didnt get a clear idea of it's use.
For example can i use it to add a few rows(animated) when the user taps on a row in the table,like a drop down list??Can somebody explain it to me or give a reference as to where i can find a tutorial??

It was pretty easy,Figured this one out on my own.All that i had to to do was modify the array from which the cells got their content,just before inserting the rows as explained in Apple's documentation.'reloadData' takes care of the rest.
One thing to note is that the logic for setting the cells content should see to it that whenever reload data is called, the cells get correct contents from the array.

Related

Does React Data Grid have "Read Only Deletion" in addition to "Read Only Edit"?

React Data Grid has a Read Only Edit feature that allows you to turn the grid into something like a "controlled" component:
Use this if you want to manage the grid data state externally, such as in a Redux store.
It works well for edits, but I can't find a way to handle cell value deletions in a similar way. When you press Del while focusing on a table cell, the deletion seems to happen in-place. There doesn't seem to be a "cellDeletionRequest" which complements the existing "cellEditRequest".
Consider this example from the docs. Before completing an edit:
After completing it:
However, deleting a cell doesn't seem to trigger any deletion request, the cell's value is updated in-place, making it difficult to externalize the grid's state:
Is there a workaround for this apparent limitation?
Unfortunately, ag-grid doesn't seem to have a function like cellDeleteRequest
or detecting cell deletions yet. But you could use onCellValueChange to detect general events of a changing cell value including cell deletion.
Have read of Column Events for more detail about onCellValueChange
Hope this would be helpful!

ag-Grid increment cell value after button click

I'm working with ag-grid I have a table that looks like the one provided HERE. In my own project, I am using an external api that will receive a real item. I need to update the Received Quantity after the done. Unfortunately, the api doesn't return anything other an a status code. So I can't do something like remove the row and a new row and this particular endpoint is also throttled heavily so I can't just refetch the list over and over to update it (which probably isn't a good idea anyway).
My plan was to just take the current value in Received Quantity and increment the cell myself. I can't seem to get it right and I just out of ideas of how I can possibly do that (I know it's probably simple by brain is just fried).
I'd really appreciate it if anything who's done this can help me out.
I ended up figuring this one out after a couple days not thinking about it. So I'll answer my own question for anyone who needs to know in the future.
I was trying to "edit" the data when I really needed to "update" it.
Essentially, every row in your grid will have a RowNode. You can access this node from the params of the row . Every is RowNode is indexed and has a setDataValue function which you can use to update entire rows or single cells. Click the update link above to reach the relevant documentation.

Smartsheet-api, Is there any way to get manually deleted row using smartsheet api or sdk call

I am deleting row from a sheet, On a sheet I have daily job which needs to recognize the deleted records, I need a way to recognize them using smartsheet api or sdk..
Thanks in advance..
I don't believe this scenario (identifying deleted rows) is explicitly supported by the API at this time. Seems like you could still use the API to achieve your goal though, with a bit more work (code) on your part.
Your code would have to get the sheet data (i.e., all sheet rows) at a regular interval and save that data somewhere -- then each time job runs, get the sheet data again and compare that data to the data you saved the previous time the job ran (to identify any rows that had been deleted).
Edit 9/26: Added Webhooks info
Note that with the approach I've described above, any rows that had been added AND deleted during the interval between job runs would not be detected. If it's important to identify each and every time a row is deleted, a better (and much more efficient) approach would be to use Webhooks. By using webhooks, your application subscribes to notifications for a specified sheet, and then would receive a callback (HTTP POST) from Smartsheet any time the sheet changes. Your application would need to inspect the information in each callback it receives to identify 'deleted row' events (eventType = deleted and objectType = row).
A simple way to do this is to add a column with a checkmark named "delete" or something similar, then with automation you can move the row to another sheet when the flag is detected, the row will be removed from the original sheet, but you will have a record of the deleted row in a different sheet that you can read or do what ever you need to do, this will also prevent deletions by mistake and you can even restore the row back if you need to. I don't think you need much code to implement this solution.

Delayed Table Name Resolution in View

I have a view over a table. It turns out the table gets moved and an updated version of it created each night. This ensures there is always a table of the expected name present in the database, but I cannot find a way to make my view continue to point to the current version of the table. Whichever table existed when the view was created is the one I end up pointing to even after it moves and goes stale.
ViewA:
select a, b, c from todays_table;
todays_table stays current all day, then at night it gets renamed to todays_table01. View A now points to todays_table01 and a new table shows up called todays_table. Again, todays_table is current, but ViewA no longer is.
Is there a way to delay the table name resolution until the view is used? I haven't been able to get EXECUTE IMMEDIATE working for SELECT statement. I think I could get a dynamic SQL statement working if I used a cursor, but I have never needed these before and I'm not sure if they are the right path. I read about AUTO_REVAL but I believe this would only delay resolution until the first time the view was used and still go stale that night.
I could, of course, stop using the view and just move the complex query into my program but there are many places it is needed so I would like to eliminate all other solutions before falling back to this.
It would be ideal to eliminate the temporary table and just have the master table receive updates throughout the day but this is beyond my comprehension as I know nothing about RPG II and OCL.
Thanks for reading.
Edit
Per #Mr. Llama's suggestion, I experimented with using synonyms and aliases to point to todays_table and then having my view point to the synonym. Unfortunately in this scenario, the view uses the alias to resolve the actual table name on creation so the view continues to point to todays_table when it is renamed to todays_table01, though the alias continues to reference todays_table.
Edit 2
I'm accepting #mustaccio's answer because it does work and would be a reasonable approach to this problem if I could get the parameters going where they need to. My particular project requires flexibility so I am actually going to jump on the nightly process bandwagon and add a program to recreate my views after the process messes with their references as #danny117 suggested.
Thanks to everyone who replied though, I learned a lot about how all of these pieces work together.
I think you might be able to achieve what you want by wrapping your view definition in a SQL table function, something like
CREATE FUNCTION insteadofview (<parameters>)
RETURNS TABLE (<columns>)
...
RETURN
SELECT <the rest of your view definition>
Depending on how you query your view, you will probably need to pass search criteria into the function as parameters, otherwise performance will be suboptimal because the function will have to return all rows from the query before search arguments can be applied.
According to the manual, as you have noticed views on a table that is renamed continue to point to the original table object. Routines, however, including table functions, will be invalidated and their plans prepared again when they next invoked, using the original source table name.
I have no way of testing this though.
Full syntax to create a table function.

Better way to loading Table with data coming from server.

I am implementing tableView which loads data from server. I got two scenario:
Get complete data from the server and store in the array say 500 items. Now whenever I need those data I will call my array and fetch data accordingly. In this case, loading huge data from server at first time will take place.
Get required data say 15 from the server and store in the Mutable array. And, if User has scroll down ,get data from the server again and add those in mutable array and display those in the table accordingly. In this case, whenever user will scroll up and down, we have to call server like Lazy Loading.
So, which would be appropriate way to load table from server.Any Feedback will be appreciated.
I think you should be use Lazy Loading. Pull To Refresh.... tableview is available for that. every refresh get 15 records and add into your array. i think this is the best way. because if you load 500 items at a time and any user required only 5th item, so other record are not useful..so i suggested you to use 2nd way.
I think for better solution you can have a bottom cell named "Load more items", click on that cell will load next set of items, it will help both user and programmer for avoiding unwanted items.