How to select 2nd row of table and enter data in column if 2nd row is contains data, then it selects column of 3rd row using cypress devextreme table - cypress

Want to enter data:
My Code:
I want to select 2nd row of table and enter data in column because 1st row is disable and if 2nd row contains then it auto clicks on 3rd row. My code selects 1st row every time

You can't use cy.get().get() sequence like that, because the 2nd .get() starts searching at the <body> element and ignores the first cy.get().
The correct sequence for your test is cy.get().find() because .find() does start it's search from the result of the previous cy.get().
To locate the empty row, you can use .emptyRow class in the selector.
cy.get('#TWGanttArea')
.find('tr.emptyRow')
.find('td.taskTitle')
With DevExtreme DataGrid you have to click the cell before you can edit data.
cy.get('#TWGanttArea')
.find('tr.emptyRow')
.find('td.taskTitle')
.click() // edit mode
.type('some data here') // data entry
The DataGrid may modify the DOM after clicking, in which case you may get "detached" error.
If that happens, use an alias to perform the steps.
cy.get('#TWGanttArea')
.find('tr.emptyRow')
.find('td.taskTitle')
.as('editCell')
cy.get('#editCell').click() // edit mode
cy.get('#editCell').type('some data here') // data entry

Your code is selecting the first, uneditable row every time because it contains the same class as your row to select. If cy.get() returns multiple elements, then the first one is yielded to the subsequent commands if a specific element is not specified. So, we can get around this by specifying .eq().
cy.get('#TWGanttArea')
.find('.taskEditRow') // use find, because get always starts from root
.eq(1) // yields the returned element at the index-0'd 1 position
.find('td.taskTitle') // finds child elements of type td with class taskTitle
.type('foo');

Related

Adding a drop-down menu (data validation) after each row of a query result in Google Sheet

First, here is the link to my sheet:
https://docs.google.com/spreadsheets/d/1067N1SAIwpGkMRBZiUv4JW8yDNkozuGt7Fwh6GW-qvE/edit#gid=1742559851
If you look at the tab called "Selection", I have two columns called "Select". All the data in these tables is collected by a query function, except column "Select". In that column, I need to add Data Validation (a simple Yes or No). I want the Data Validation to be automatically added when a new row is created but the query function instead of having to add or remove it manually every time I make some changed. Data collected by the query function is using the two variables on top of the sheet (minimum rating and global buff).
Just to show the step to apply data validation to your whole column, see the following image. Under Cell Range, the image shows Selection!D5:D99, but this is actually set to Selection!D5:D999, it just is truncated due to the size of the text box.
Let us know if this is what you were looking for, or if I've misunderstood your issue.

How to add rows with values already predefined?

In Oracle APEX I have a tabular form that returns one row and has cancel, delete, submit, and add row buttons. When I click the add row button it adds an empty row to the form but I would like it to add a new row with certain columns already filled in containing the same data as the first row. I was thinking I'd have to add a PL/SQL process to the page. How would I go about doing this?
You could set the default value for each column in the report to be based on the value of a hidden item (a hidden item per column) and set the values of these hidden items in a page load process by running the same query that populates the first row of the report.

Using XPath to locate on a button within a table

I have a table with several columns. The first column contains unique data, the 5th contains three buttons (Edit, Assignments and Delete).
I would like to use an XPath expression to locate on the edit button for one of the rows by indentifying the row using the unique data from column one (think that made sense).
I have built some expressions which will allow me to locate on the first column and edit button independantly as follows:
//td[text()='Managers']
and
tr[2]//button[text()='Edit']
The closest I can get to doing what I want is:
//td[text()='Managers'] | //tr[2]//button[text()='Edit']
...However this will locate on the data/button in column 1 AND 5 at the same time, what I want is just for the button in column 5.
The reason I want to do it this way, is so later I can pass in 'Managers' as a varaible in order to select the row (as its unique and meaningful data), and then press the edit button in a different column on that row.
Hope this makes sense!
Thanks
The question isn't very clear as posted, especially because I can't see any relevant part of the HTML. But if I understand this correctly, you can try to select the row that has Manager in it then get corresponding Edit button like so :
//tr[.//td='Managers']//button[.='Edit']

jqgrid delete row only on screen and save the deleted row

I'm using jqgrid with inline editing , when the user gets to the last cell inside a row , when he clickes on "tab" key he will be editing the next row - and if it does not exist a new row will be created.
I want to add a delete row function for the user , but still to have that row data inorder to send it later to the server as a deleted row.
I tried hiding the row , but then when the user "tabs" to the next row - it goes to the hided row - and i want it to go only to the not hided rows.
Is there a way to mark a row as deleted? and then when I generate the xml from the grid rows it will be a part of those rows? or is there a way to delete the row and save it's cells values , and be able to navigate throgh the grids line without going throgh the deleted line?
Any help will be appritiated!
Thank's In Advance.
To fix problem with editing of hidden row you can try to add class "not-editable-row" to the row which you hide.
$("#"+rowid).addClass("not-editable-row").hide();
If it will not help you will have to overwrite the default "TAB" behavior of jqGrid (see the question for implementation details)
Probably more easer way would be to use delRowData which delete a row from the grid without sending any information to the server. If you want to have your custom implementation of the "Delete" button in the navigator (see the example here). Inside of your onClickButton event handler you can save the contain of rows, which will be deleted, to some JavaScript array/object and then delete the row with respect of delRowData. So you can trace all delete operation, save deleted rows and send later all needed informations to the server.

How to populate dynamically generated select boxes with ajax

I haven't been able to find a solution for the particular problem I'm having with this project. I need to the following: dynamically add rows to a table that contain two select boxes AND use ajax to auto-populate the select options of the 2nd select box, based on the value of the first select box... in the respective table row (that was dynamically added on the fly by some js).
Still with me?
I can easily populate, dynamically, a select drop-down using ajax/javascript based on the value of the first drop-down, in the first row. I can even populate three or more select boxes in the same row, using ajax/js functions to load each additional select. Yet, this is not my goal.
Here's what I have... My form contains a simple table with 3 columns. First is a checkbox, the second is the "State" select box and the third column is the "City" select box. I have two buttons above the table that allow me to "Add Row" and "Delete Row". Mind you, the first row (which is programmed-in), works perfectly for loading the city names of a state using ajax.
Upon clicking the Add Row button, I'm able to create the second row dynamically, which contains the checkbox, state select and city select fields. The state select is populated based on the innerHTML content of the original column, but the city select is obviously null because it is expecting ajax to fill it. Note: the names and ID names of these fields are iterative... city_id, city_id_1, city_id_2, city_id_3 and so on... so I have that uniqueness to work with.
My problem lies in the fact that when I select a state from the 2nd or 3rd (and so on) rows, only the firstcity select changes. Why? Because the js/ajax processing function says to operate only on the element with name "city_id"!! Which is the name of the city select box in the first row.
I have not (yet) found a way to dynamically pass the name of the element I need updated to the onreadystate ajax function. When I've needed to populate two or three select boxes in a row (same row), I've had to have complementary ajax functions for each drop-down - which are static, mind you... but what if I create the element dynamically?? I can't pre-program that many functions into my page... or must I?
If you have any ideas on how to accomplish this I would be soo damn appreciative!!!
Thanks!
var i=1; // put here the number of the column being added now.
var x=document.getElementById("city_id_"+i);
// populate x

Resources