MUI DataTable - Save Column and Reset Column - mui-datatable

I am implementing MUI DataTable in my Project and I need some help with Save and Reset of Columns.
Requirement - When a column whose display:false (Let's Say - Name) and I go to ViewColumn Icon of MUI DataTable, it appears unchecked. This is fine. Now, when I check it, that column appears on my Table. I have created 2 Buttons on TOP of the table which says - "SAVE Table View" & "Reset Table View". When I click on "SAVE Table View" , I want "Name" column to be permanently added to my column (storing data in localstorage is also fine). And when I click "RESET Table View", the Name column should no longer appear in my column(Remove from local storage.
I am new to React and Datatable so I am not sharing any codes because I haven't been able to come up with a logic.
Please Help!!

Related

Click on one DataField in gridview will open a new grid view

My Target:
I have one gridview on the asp page now the first column is showing some numbers (which is primary key in SQL)
Now I want if someone clicks on any of the number he should be navigated to a new page where he can edit the fields connected to the number clicked.
Note: in the first grid view I have not selected all the columns from sql but in the editing page i want most of the columns from database.
Broad ask. Guess you added right tag asp.net but you mentioned asp page.
Add hyperlink in the id column of gridview to navigate to edit page with Primary key value as querystring.
In pageload of editing page, read the querystring & query all the Columns of record you need using id, edit & update the DB. At the end response.redirect to grid page.

Trying to open another form in Access based on a field in the current form

I have a form that's just a list of descriptions (desc.) of other forms. Right now, when you click on a desc., the appropriate form opens; but it's done through a series of if statements in a macro. This isn't going to scale well once more forms are created.
I have a table that has the desc. and the form that is supposed to go to. I want to write a script that uses this table to open the new form based on the desc. clicked, but not using if statements. The end goal is to be able to just add a row to the table for any future forms that are created without making changes to the script or form. Is there a way to do this?
Use a combo box whose row source is a query which selects the form description and name fields from your table.
The combo will have 2 columns. You can set the width of the form name column to zero if you want to present only the form descriptions. If you make the form name column the combo's bound column, you can reference it conveniently in a DoCmd.OpenForm statement. For example, you could have a command button whose click event opens the form which is currently selected in the combo ...
DoCmd.OpenForm Me.YourComboName.Value

Delete row from Access junction table via form

I set up a subform listing stored values from a junction and lookup table. This part is working nicely (I can view all stored entries or add new ones).
Here are my relationships:
And here's the layout of my form showing where I attempted to remove a previously saved association. If I simply delete the contents of the row in the form, Access returns this when I try to save the record: index or primary key cannot contain null value
The SQL to remove a row from a console is straightforward:
DELETE FROM junction_model WHERE cust_id = X AND model_id = Y
Removing a row from the form is proving not to be as straightforward.
Is there a relatively easy way of doing this from the form itself?
Those little squares to the left of the combo boxes (one of which has a "pencil" icon in it, indicating a dirty record) are the "record selectors". Clicking a record selector will select the record, then if you hit Delete the record will be deleted.
It looks like you just deleted the contents of the combo box. When you went to save the (still-existing) record Access objected because the .Value of the combo box was Null, and your Primary Key on the junction table prohibits Null values for [model_id].
For the benefit of others combing back to this:
One option (perhaps more intuitive for the user) is to add a Delete button to your subform. Open the subform in Design view and add a Button from the Controls palette, with control wizard turned on. Command Button Wizard should open - choose 'Record Operations' from the Categories list and 'Delete Record' from the Actions list. The rest of the wizard will customize the look and name of the button.
I'm using a similar form and each row looks like this, with the (X) being a little delete button after the combo box:
Ford Pinto (X)
If deleting is important, I think the button is a much more visible method than clicking the 'record selector' and pressing the delete key.

how to populate textbox with the database value based on combobox change in access

I am new to Access and vb and i have failed to get the result what i am thinking to get ,hope i will resolve with your help guys
->my access database contains one table with following fields
firstname lastname middlename phone
I have two combo boxes and two textboxes
combobox- it populates firstname and based on this selection the other combo box has to fill with last name which i did successfully with the help of Me.Combo2.Requery
but i dont know how to fill middle and phone in textboxes
here i am failing in mapping recordset and connectionstring with my table and getting result to textbox value can any one help on this
You still have not said where the connection string comes from or why. The big advantage of Access is that it is fast and easy, for the most part, you do not need connection strings.
First, select your table, then choose create form. This will create a single form bound to the table. You could have created a query first and chosen that instead.
That is it. You have a form that displays your data. The key to this is the property sheet for the form, which you can find by switching to design view and double-clicking the small square at the top left of the form just under the form name. The property sheet will show the name of the table or query on the Data tab under the Record Source propery. You can, of course, set this property manually.
You can now add a combobox to select records, but you do not have to, there are navigation buttons at the bottom of the form.
To add a combobox that selects records on your form, you must have first bound a recordset to your form using the steps above. Next, ensure that the wizard is selected for the toolbox. Unless you have unselected it, it will be selected. Now choose combobox from the toolbox, it will open the wizard.
Choose find a record on my form and press next to choose the relevant ID field / column and any other fields that you need. When the wizard completes, in MS Access 2010 (and probably in 2007) it will add an embedded macro that finds your record and in earlier versions it will add code. Other properties set by the wizard will look something like this:
Row Source : SELECT ID, Firstname, Lastname FROM Table1
Column Count : 3
Column Widths : 0cm;2.54cm;2.54cm
Your table should have an ID, add one before you start, if it does not. The wizard will not add a Control Source when this option is selected because it is not needed, in fact, it would be a disaster to add a Control Source to a combo that finds records. Once again, you can do this manually. The code to find a record might look something like:
Private Sub MyCombo_AfterUpdate()
With Me.Recordset
.FindFirst "ID=" & Me.MyCombo
End With
End Sub
This works because the bound column of the combo is set to 1, the first field of the select statement, which is ID.
The combo includes two other fields / columns and you can refer to these in a textbox by setting the control source of the textbox to:
= MyCombo.Column(2) ''Lastname
Where you count columns from zero:
Row Source : ID (0), Firstname (1), Lastname (2)
Cascading combos are another story altogether, and you can read it here How to synchronize two combo boxes on a form in Access 2002 or in Access 2003 and here Is there a simple way of populating dropdown in this Access Database schema?

Auto populating text boxes on an Access 2003 form when value selected in combo box

I am building a form in access database.
I have a combo box which is linked to a query which is looking up a unique reference number from a table called Tbl_Submitted_Requests.
What I need the form to do is auto populate the other text boxes when the user selects the unique reference from the combo box. How can I get the text boxes to auto populate with the data that is associated with each unique reference?
Thanks
First, bind your form to Tbl_Submitted_Requests or better, a query that uses this table, you can do this with the form wizard or by setting the Record Source property of the form. Each of the textboxes will also need to have a control source set to the name of a field (column) Next, add a combo and choose "Find a record on my form based on the value I select in my combobox" from the wizard options.
I will agree with Remou's response, with one small edification. Crate a new form, and drag all of the fields from the relevant query or table onto this form. Alternatively, you can drag them from the field chooser if the form has already been bound. Then, create your combo-box, and choose "Find a record on my form based on the value I select in my combobox" from the wizard options.