Drop Row At Numeric Index - SQL - javascript

I am attempting this in the JavaScript language using the Titanium IDE.
What I'm doing is populating a table from an SQL database, and then allowing you to delete rows in this table. So, when the user chooses to delete a row in the table, I will get it's index in the table (ex. row 5), and then pass this to the SQL and drop the row at the index (so, row 5).
Did some research and couldn't find any decent sources on this, and so I essentially need a way of dropping the SQL table row based on the numeric index of the row the user selects.
Thanks!

Your SQL table should have an unique id for each row. So when user select row on your table, you have to match it with that unique id and then just remove that unique id from database.

Related

Delete Rows from a repeating table in Winshuttle Evolve tool

I'm trying to delete a row in a repeating table where a particular row is selected using a checkbox. I need a JavaScript code to achieve the same because there is no standard rule available in the evolve composer.
I tried following methods but none of them are working.
$form.deleteRow('XPath of row field of a repeating table');
$form.remove('XPath of row field of a repeating table');

How to select mutliple rows from a table and pass the selected values to the backend. i am using the MEAN stack for doing this

From a table i need to select some rows and pass it to the back end for table how to select particular entries

Select HTML Table Row and Identify DB Record ID

I’m developing a simple CRUD based application for upskilling purposes.
Currently, the application outputs the result of a select query to a HTML table using JSTL. The last column of this table has a Delete link for each record which sends the parameters action=delete&id=1 to the server. The id param value part of the href of these links are obviously dynamically generated with JSTL based on the database record key that is passed into the JSP with the database results.
Instead of having this Delete column, I want the user to “select” a row and click a Delete button at the bottom of the table, which will send the above parameters to the server.
I am unsure how to accomplish the following to achieve this:
(1) In Javascript, how can I allow the user to “select” a table row. I don’t want the table to have radio buttons. The behaviour should be that the user clicks the row, the entire row colour changes and JS retains the index of the selected row. Only one row can be selected at a time. If the user clicks the row again, it becomes deselected, i.e. the colour is returned to its original colour and JS no longer identifies that row index as being highlighted.
(2) If I don’t have a Delete link specific to each db record, how can I identify the key of the db record to be deleted and return this to the server when the Delete button is clicked. For example, currently if the record in the db has an PK of 123456, my JSTL will generate a href action=delete&id=123456 for that specific Delete link. So, how can I link that id to the selected table row without having to actually display that id in the HTML table.
1) There are plenty of ways to do it. I suppose all of them will involve the use of something like var rows = document.getElementsByTagName("tr"); or its jquery (or other framework) equivalent. Or some other selector, maybe by CSS classname, could be used. Followed by a loop in which you deselect all the rows that were not clicked and select only the one that was recently clicked. Changing the color equals just changing the css class assigned to the DOM element basically.
2) You will use Javascript either to append to the DOM an html form with hidden inputs (<input type='hidden'.../>) and then submit it via Javascript (if you're Ok with moving to a different page and back). Or you can use Javascript to send an Ajax request to the delete servlet, and then remove the particular tr from the page when you receive a success response back.

how to get the rowID in jqGrid is data based on the data in the column?

Im trying to get the rowID of a particular row in jqGrid where on of the columns of jqGrid contains the specific data.
for e.g. if one of the columns in the row is "instanceNum" than i want to do the comparison first with the "instanceNum" stored in an array with the "instanceNum" displayed in the column.If both "instanceNum" matches than i need to get the id of that row.
I'm new to this jqGrid so please help me out or guide me in the right direction.thanks

How to put database record count in GridPager in jqGrid?

jqGrid pager is showing the number of rows present. I want to show the number of actual records present in the grid from database? Actually the grid has only one extra row and that's being counted. I want to get actual database record count to show there.

Categories