How to handle Multiple check-boxes in Reactjs? - arrays

"I am really stuck in this problem for past 1 week. Actually I am getting an array of strings from the API that contains the ID of employees. Now I am showing it in a table and it contains check-boxes before them. Now when I sort the Admin ID column, the Admins get sorted out but the check-boxes are left in there original position."
So I want a solution where both the Admin ID and check-boxes move simultaneously with each other on sorting that column.
I will attach some screenshots of the table so that it will be easy to understand the problem"

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.

Bound combo box in form does not always update table

I'm struggling with a problem which I can't work out is due to a logical error, a design error or both. Or maybe it's something else entirely.
I have created a simple customer services database and form based user-interface for my company. When a user answers the phone they are supposed to log the call in the system if it is an issue relating to a product.
Sometimes a chain of stores which we have a special relationship with calls up on behalf of customers and we take their reference number and give them ours. This system actually works pretty well if I may say so myself (!), but I noticed after a while that when this store calls up and gives us their number, when they are logged into the system their branch number/name is not updated in the table record.
Here is a summarised outline of the relevant database tables. I renamed the store to SpecialStore:
Issues
IssueReference
ProductID
CustomerID
SpecialStoreBranch
Customers
...
Products
...
SpecialStore
SS_ID
City
Address
The idea is that even if it is either a customer or the store with their own IDs, the products are still stored in the same Products table, just with either the CustomerID or SS_ID filled in. Then when issues are logged, the store or customer is set and logged against a product.
In my main form I have a variety of boxes for a new issue to be filled in. There are combo boxes to select the CustomerID, ProductID etc, and of course the SpecialStoreBranch. These are all bound to the table, and the combo boxes all have row sources relating to their particular table. E.g. CustomerID combo box is a list of the IDs in the Customers table. (This is filtered to the required one elsewhere in the form.)
The Issues table SpecialStoreBranch field has the following query as its Row Source:
SELECT SpecialStore.[SS_ID], [SpecialStore].[City] FROM SpecialStore;
This is the same row source for the combo box on my main form.
The Column Count is 2, with the Bound Column as 0 and the column widths, if necessary, are 1cm;2.544cm.
My main form combo box SpecialStoreBranch has the other attributes:
Limit to List = yes
Allow Value List Edits = no
Inherit Value List = yes
Show Only Row Source Values = no
On the form the CustomerID and ProductID store correctly when the record is saved, and they are also from combo boxes. The form refreshes to update those fields when another part of the form (adding new customers and products) is changed. Could this be why the SpecialStoreBranch does not update? What am I missing? Is there a way to test this? I have been trying to run user tests to see if it ever works, but all I know is that it doesn't always set. If I have forgotten a piece of information let me know.
Edit:
Looking here: BoundColumn-Propery, I'm not sure if setting the bound column to 0 is doing what I think it's doing. But even then it should still use that id number to input into the table I would have thought and if they are all the same, what does it matter. When I tried setting it to 1, it took the text value in the table. Confusing!

How to make title sortable with two different tables whose data coming from same model in cakephp?

I have a view showing two tables which data is coming from same model but based on different column status I divided in 2 tables. Problem is, when I click on top table's column name heading for sorting, it also sort the bottom tables. I'm wanting the bottom table data won't sort when I click on top table column heading title. If any one have a good solution, would highly appreciated.
This highly depends on your setup, but you're going to have to do some custom code.
For example, don't allow Cake to sort for you. See what the links look like when created by Cake, then write your own, and include an additional variable &table=1 or something.
Based on the sort variable and the table variable, build your pagination options for each including the correct sort you want for each group separately.
Another option (depending on how large your data sets are) is to use javascript datatables.

filter data from one table based on second table without duplicates

Note: I'm working with a large complex database, so for clarity's sake I have simplified the set up below.
I struggled a bit with how to title the question since it's a bit of a complex question. I hope it's accurate enough....
A bit of background first:
I have an Access 2010 database that contains a one-to-many relationship between a table Called "Products" and a table called "Datasets" (ie I have a bunch of products, and each product has multiple datasets). Each has an autonumber key field (p_ID and d_ID respectively) as well as numerous other fields.
I have a form (lets call it frm_Main) that has two subforms: sub_Products (based on the "Products" table) and sub_Datasets (based on the "Datasets" table). On the main form I have a control ctrl_SelectedProduct which is linked to [sub_Products]![p_ID] to see which record in sub_Products is selected / has the focus, and the sub_Datasets subform is linked to this control so that it only displays Datasets records that belong to the selected Products record.
On the main form I also have a number of controls that I'm using for filtering the data in the subforms. For example, I have a control ctrl_Category. I have this control coded so that when the user changes the value of the control, a filter is applied that limits the records in sub_Products to only those that have a p_Category value equal to whatever is chosen in ctrl_Category. If the control is blank, it will show all records. All this works great when if comes to filtering based on fields in the Products table.
Now the problem:
My problem is that I also want to be able to filter based on fields in the Datasets table. For example, Datasets has a field called d_Status. I want the user to be able to chose the status in a control (ctrl_Status), and based on this:
1) sub_Products will be filtered to display only those Products records that have an assotiated Datasets record (or records) that has d_Status equal to whatever was chosen in ctrl_Status
then
2) when a Products record is selected in this filtered sub_Products, sub_Datasets will only show the Datasets records that has d_Status equal to whatever was chosen in ctrl_Status
I know how to do part2. But I have no idea how to get part1 to work. Since sub_Products is currently based on the Products table, which does not have the d_Status field, I have no way to filter it based on that field. Thus, I'm assuming my first step will be to change my setup so that sub_Products is based on a query that combines the two tables (or at least adds the d_Status field).
If I do that, however, I get duplicate Product records. I can't use the query's Unique Values property because if I have a product that has two datasets, one with status "Current" and a one with status "Archived", then those aren't considered duplicates, and the product info is there twice. If I don't have the status field displayed, it shows only unique products initially, but then I can't subsequently apply a filter based on that non-displayed field.
I also tried basing sub_Products on a Totals query in order to utilize the Group By functionality, but I still couldn't get it to work right. Even if I could I don't think that's the best solution, because you can only have 10 fields with Group By, and my Products table has more than 10 fields that I need displayed in sub_Products.
I feel like I'm now just going around in circles and am at a loss of what to try from here. Please help!
Couldn't you add something like this?
Private Sub ctrl_Category_AfterUpdate()
Form_frm_Main.Recordsource = "Select * from Products where p_ID IN(" & _
"Select p_ID from Datasets where d_Status = " & _
Me!ctrl_Category.Value & ")"
End Sub
Alternately, you can access the childform via the parent of the other child form.
This is a non-working snippet just to give you the idea:
Me.Parent.otherChildFormName.Form.Recordsource = whatever

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

Resources