Maintain ngRepeat order while bound data changes - angularjs

I am new to Angular and I am now learning about directives.
I have created a directive that will create a table.
You can sort the table by clicking on the header arrows.
You can also edit/delete a row by clicking on the action button.
The problem with my table is that when the rows are sorted by some column,
and I edit an item under that column, the table resorts because of the changed data. Thus my currently editting item moves to another row and the current input fields contain a different one.
For example, if I sorted the table by visits, and then I edit a visit data in a row,
changes to :
How can I maintain the current order of the rows during edit,
and only allow resort when I click on the apply button (check) ?

You can copy the model which will be edited during editing. And in your save function, update the actual model in table list.

Related

When adding a new row to an Antd table, make it the first row visible?

Just started using Ant, have been loving it so far. I have a working ant table and add row button, however when a row is added, it is added at the end of all rows since its ID is incremented from the last ID in the table. I am working with less than a 1,000 items.
Is there common logic or a property I can change to make adding a new row visible at the beginning by default? This way a user can visibly confirm that their actions succeeded.
Some ideas around this are:
Add a date created field and have it hidden by default, but sort by newest date
Figure out a way to make the ID column invisible and display the largest ID first..this not scalable when using GUIDs which I would prefer :(
Temporarily render the newly added row data in a special container in the table? No idea on how to go about trying this.

How to save the changes made in the NSTableView back to the source array used for the populating this table?

I have view based NSTableView with two columns. Instead of default NSTextFields I have inserted NSTextViews. For populating the table I am using the array of tuples of two strings. After I change the text in the NSTextViews I want to save back all changes from all rows and columns to the source array by clicking the button. I need to know each row and NSTextViews to get the strings for the array. How to do this ? First problem is that I cannot even make the tags for particular NSTextViews, they are inactive in Attributes Inspector (for NSTextFields tags are active).

Ms Access: How do I populate a table using a field in a form?

I want to populate a table in Access that I've just created. I gave it 6 columns. I also made a form that has 6 field inputs. But now I'm confused as to how exactly you make the form write to the table. I want the table to populate downwards, not just re-updating one row every time (in a previous attempt I managed to have the fields save over the same row, but this isn't what I want). I can provide any extra info as needed.
The Record Source property of your form should be set to the name of your table and Allow Additions set to Yes. The Control Source property of each field on your form should be set to the required column name.
You can create an Add New Record button on your form using the new button wizard, select Categories: Record Operations & Actions: Add New Record.
That is the bare minimum to start creating new records in your table from a new form.

Adding an order for a customer selected from a list view in Access

I followed this great guide to help me add a search feature to my Access database:
http://www.techrepublic.com/blog/howdoi/how-do-i-populate-an-access-list-control-with-the-results-of-a-dynamic-search/108
At the end it says:
"If you’re building a quote or order, use the list control’s Click or Double Click event to copy record(s) to a temporary table. It’s easy to implement using a fixed query for each search task."
I have managed to display all search results in a list box and I would like to be able to click on a customer to highlight them, and then press a button to add an order to the selected customer. I've been thinking how I could do it and I really can't get my head around it.
Any help would be appreciated.
It depends on how you build your database. My guess is that one easy way would be:
Create a table with customers;
Create an "Order" table with orders where you link the customers through a foreign key
You load the customers in a listbox. While making the name visible, it is actually the ID that you retrieve when clicking the listbox. You can configure this via the wizard in the design view of a table. You can make other forms appear by events on the listbox (eg. on click).
If you managed to retrieve the ID of the customer, and you have the data related to the order (data that can easily be extracted from form objects and loaded into variables ) what you need is an insert statement and insert the values in the "Order" tabel (including the customer ID, which is linked through the foreign key).
This way all order records are linked to the customer and can be queried later.
Due to my limited knowledge on your other requests, I cannot help you any further on the rest of your database design.
I hope that my reply could help you and that I understood your question correctly.
You can access info from a listbox via:
List.Value
Or if it is not the first column then:
List.Column(0,0)
0 being the column and row references.
You may also consider using a listview over a listbox and then you can access the relevant parts of a listview control with the following code:
ListView.SelectedItem
Or if it is not the first column then:
ListView.SelectedItem.SubItems(3)
3 being the column reference

Inserting rows into pagedcollectionview, while preserving the location

I have to create a grid which allows sorting and filtering. Currently I am able to achive this by binding PagedCollectionView of the data. I would like allow user to insert or delete row from the grid with context menu. User can select a row and right click on the context menu and insert or delete a row. I can delete the current row, but adding row got me stumped. When I insert a new row and since I do not know any values, I insert a blank row and that end up coming at the end of the grid.
One solution I am working on is to copy the previous row of the gird and using converter, if the row is dirty display blank.
Just curious, is there a better way of inserting row at current place in a grid while keeping sorting and filtering in place?
Thanks,
Just in case anyone is interested, what I ended up doing is insert the row in the grid manually with out paged collection view to keep the sorting and in the code behind insert a dummy row.

Resources