Sahi: find tableID from _parentTable? - javascript

I'm struggling with a really fussy piece of js in a page I need to test using Sahi. The problematic piece is a calendar which pops up when entering a date field for a particular item, and I can't just click the text box and then click on a date I retrieve/create, as there's an auto-increment happening, e.g. 4 becomes 4[1], 4[2] etc. etc.
The ID of the table which pops up when you try and enter a date is also dynamic, so is there a way for me to retrieve the tableId of this table using _parentTable? I'd like to at least try and ID the table and then try something else to click on the date I need.
Thanks,
Jason

You use _parentTable to find an element relative to another element in the same table. In your example, you say you have a number of indexed "4" links; perhaps in a popup, 12 month calendar? Maybe you want to click on December 4th, which is in an dynamic, indexed table that includes the bold text "December". In this case, you should be able to do this:
_click(_link("4", _in(_parentTable(_bold("December")))));

Related

Getting row data on Interactive Report

Morning,
I'm currently using an Interactive Report on APEX that contains several columns, some of them being checkboxes that represent if a certain number is present in the table that is being used to fill the report.
For example, row 1 has a telephone number "99091021", row 2 a provider, and the following 5 rows are checkboxes that should represent branches in certain areas. If a checkbox is clicked, it means that this number is present in that area.
Now, I'd like to create a dynamic action that inserts that number into that table when I click the checkbox (and it becomes checked), and a delete for when it's also clicked (and becomes unchecked). Problem is, I don't know how to access the rest of the data in the row of the IR to use as a comparison for the delete and insert statements.
Say I try to click the Checkbox 3 on the row where the telephone number is "99091021". A dynamic function would get the data row, then a true action would compare the necessary data to perform either an insert or delete, depending on the state of the checkbox. That's the plan.
I've done something similar before, using localStorage, but it didn't quite work, because before I used it on an interactive grid. Is there a similar function for interactive reports?
Also, is there a way to check if a checkbox is checked or unchecked in a PL/SQL Code?
Here's the solution I found:
I had a select that got the necessary data for the Interactive Report, but because I kept getting an error of temporary data table being exceeded and always breaking the server, I had to change the checkbox query to something like this:
apex_item.checkbox (1, '1_'||a.pk, case when max(decode(b.nr,1,1,null)) is null then '' else 'CHECKED' end) as checkbox1
The '1_' part represents me selecting the first checkbox. With the value still there as the selection, I was able to do the following:
$s("P165_GET_PK",this.triggeringElement.value)
The result would basically be "1_PK_number". With this function I was able to get the value (a.pk) hidden in the checkbox to an Apex item, and then continue using it for my insert and delete statements. It's just a matter of separating the value in it with substring functions and so on.
Now I can delete or insert new data inside that table with a simple click.
I hope it helps in case someone tries doing something similar.

Add dynamic column to table in smart-table [angularjs]

I needed a little help over here on adding dynamic columns to table and I'm using smart-table project https://lorenzofox3.github.io/smart-table-website/
Please look at plunker
https://plnkr.co/edit/uTDa6hfwdgGtGWkYqL7S?p=preview
Click on add new column, it will update the table header, but I can't update the td element because I haven't created or binded any td element for new column.
Need help on two things.
1) Any number of new columns might come in future from server dynamically, so I can't bind any element statically in html like I did right now.
2) This is a little long one(I want to create a only one header as MV and in colspan I want current and next) and How do I accomplish that one ? If I divide like that, how do I go frame the data ?
Additional Note on Question 1: I have tried dynamically showing the data in table. please look at line 27 in index.html. But again, If I go with this approach, the values get binded to different different columns since, data's are framed dynamically on controller. To be simple, there is no guarantee that data will be in in this order.
(SNo, companyName, companyFullName, MarketValueCurrent, MarketValueNext, QuarterCurrent, QuarterNext)
companyName might come first or at last. If I go by dynamic looping using ng-repeat, it binds MarketValueNext in first column, then companyName, etc in whichever the order the data is coming.
Thanks in advance.

displaying specified div in order based on clicking dynamically displayed dates with jquery/javascript

Here is my code: http://js.do/jane-d0e/80399
I have predefined div's, each are going to contain different content and styles.
I want to have a user enter a start date, and then restrict the end date so they can choose up to 7 days. I have been having a problem implementing the date restriction, I try doing "+7d" for max Date but for some reason it doesn't limit it correctly, it is always showing more than the amount I specify.
So say the user chooses a date range, with 7 days total. The date range appears below. If the user clicks on the first date, the content within the first div is supposed to be displayed only. The next date that is clicked the content in the second div is displayed only, and so on. So div1 maps to first date.. div7 will map to 7th date if there is a seventh date. I thought of trying to do this with next() but this did not work, now when I run the code and select a date it opens the whole set of divs for each selected date rather than the single intended div.
What is the best way to go about achieving this?
Destroy "to" datepicker after "from" date selection to change "to" datepicker for a specific range and pass mindate, maxdate.
$("#to").datepicker('destroy');

A bar that takes date input by range and also let us write tags in it.

I am making a responsive time sheet. i want to take input by date ranges so that if user selects date 1-july on one end and 10 july on other end, i must get 2 dates and it must be able to take input about the work.
for example i selected 1-july on one end and 10 july on other end. and in that span, i want to put a tag that this task was done in this time span.
like this:
http://jqueryui.com/resources/demos/slider/range.html
instead of price range, i want date ranges and i must be able to define tags inside it.
any ideas of how to do this in html5, jquery or javasript ?
I believe this is your answer...enjoy!
http://ghusse.github.io/jQRangeSlider/documentation.html#dateSliderQuickStart

Populate tabular report (multiple records) with particular values

I have a tabular report that allows the user to enter a reference number (text item) as well as a comment textarea item.
The report can vary in amount of records displayed, but for this example, let's say I have 10 records in the report.
What I am after is to create two new fields identifying both comment and reference no field - let the user type info in these two fields and then have a "Populate All" button that will go through each record in the report and assign the reference number value and comment value to each of the 10 records.
It's not completely clear what you're trying to do here. Do you have a regular HTML form laid out in a table, and then the last two table cells on each row have an input/text area element in them? If so, I would think the easiest way to go about it would be to assign a common class to the input elements in each column, such as 'refno' and 'comment' then have some code like this in the 'PopulateAll' button onclick event:
$(".refno").each(function() {this.value = $($("#refglobal").value)});
This assumes your field for adding the reference number to all has an id of refglobal and that you're using jQuery (though other libraries will allow similar syntax, and coding it out longhand wouldn't be too much effort in this case).

Categories

Resources