I am using a jQuery plugin named "Table-to-JSON" (http://lightswitch05.github.io/table-to-json/) in order to convert an HTML table to a JSON object. Everything works smoothly.
My problem has arisen when I use another jQuery library "jQuery UI Tabs" to have multiple tabs within a single HTML file.
On each tab I have a table. At the bottom of the page I have a save button. I would like to give the chance to users to press the save button and for each table in each tab the corresponding JSON object to be saved.
The problem is that when you press the save button, you can only save/export the JSON object of the current (selected) tab. Add some more tabs and then, when you try to export(alert) the JSON object of each table in each tab (only the table of the selected tab is exported) , the rest of them are empty [] as you can see in my jsfiddle example provided below.
I would like to export all the JSON objects of each table in each tab.
Is it a jQuery issue regarding IDs? or table-toJSON library does not work with jQuery-UI tabs?
Any advice would be appreciated.
there's an option for the function tableToJSON called ignoreHiddenRows.
set this option to false to accomplish what you need.
here's the fiddle : http://jsfiddle.net/7t5cB/
Related
On my Webpage I have three Dropdown Controls. When First Option is selected in the First Combo, the Second Combo Control Gets Populated and similarly on selecting an Option in the Second Combo populates the Third Combo Control.
Each Combo Control has a above it. Using Selenium in VB.net, I am able to find the First Combo Control and iterate through each Option Available. The Challenge I am facing is that, the label on Second and third Combo gets its text from the the Selected Option of the First and Second Combos, respectively. However, the XPath changes randomly with each option selected due to which the FindElement(By.Xpath) fails.
The example Combos are available this Link Set of Three Combos
I tried using the following VB.net Code
Dim CWEstring = "./following-sibling::select"
GE = New SelectElement(driver.FindElement(By.XPath(CWEstring)))
and
Dim GEString = "./following-sibling::select"
GE = New SelectElement(driver.FindElement(By.XPath(GEString )))
I did my research for few days but couldn't get the answer, so posting here for help.
Use the following xpath to identify the element.
1st dropdwon:
//select[#id='edit-field-select-zone2-value']
2nd Dropdown:
//select[#id='edit-field-cce-army-no-1dinjan-cwe-tid']
3rd dropdown:
//select[#id='edit-field-pm-khonsa-tid']
Please note you have to provide some wait after selecting each dropdown item to appear next dropdown on the webpage.
I Downloaded the webpage Source and Edited the code to bear minimum HTML content so that all three Combo Controls are visible and save the html content as a .htm file on local disk.
Using chrome I opened the .htm file. Then Using MS-Excel From Web under Data tab Scraped the data from the local .htm file.
Now I had all values under one Column Header name. I converted all values under column name into an array.
Using VB.net and Selenium technology, I iterated through each combo control and saved the data to a New Excel File.
More Challenges came to fore. Therefore, I used Try...Catch method to trap the error and Continue the Iterations (Loops).
And now I have all the values the way I wanted them.
I searched about tabs in VB6 over and over, but I couldn't find anyway. How I can replace buttons and other thing in which tab?
Private Sub TabStrip1_Click()
Here I found the answer. All objects in each tab must be in one frame and each frame must be for a special tab.
http://www.vb-helper.com/howto_use_tabstrip.html
Start a new project
Add a new form from availables templates: choose the Options window template
Now you have a form frmOptions which contains a TabStrip named tbsOptions, complete of code to manage the tabs using the Click event.
I'm currently using Perl CGI to display some internal billing pages at work. I'm using JQuery as well to add a little 'spunk' to it if you will.
I'm looking to generate/display HTML based on drop down selection by the user. Now, I can handle this part no problem. I'm generating table rows/table data on click based on the selection made by the user.
I want to retrieve and display values stored in the database for the corresponding data im displaying on button click, and without refreshing the page of course.
Can someone point me in the right direction? Thanks in advance.
You'll want to use an AJAX request to get the data. So, for example, if you have a select with class 'ajax' and you want to display data based on the option selected, you can do something like:
$('.ajax').change(function(){
$.get({'url', { value: this.val() }, function(data){
// display the data with a .html() or .append() or something
});
});
Replace 'url' with the url of a page that queries the database using the value that you send it.
I am loading 2 jQuery UI tabs with data from ASP.NET MVC 3 PartialView using $.ajax(). I am specifying the '/controller/action' as URL. This works fine and I am able to load the two tabs with content returned by the partial views.
I have a Save button in the _layout.cshtml.On clicking the Save button, I want to get data from all tabs and send it to the controller as a JSON object.I want to use only one Save button for saving all data in the tabs instead of having Save button at the bottom of each tab.
The problem is I am able to get data from only the first tab. I get 'No Source Available' error when I try to get data from the other tab. The $('#some_id').change() event is also not fired for the controls in the second tab.
Please suggest if there is a better way to implement this ?
I would also like to know why the HTML generated by PartialView is not seen when I view source HTML of the page ?
Thanks.
It turned out to be an issue of async requests that were being made to load the tabs. I used the load() of jQuery tabs to resolve this.
I need to manipulate my Mysql data on:
I populate Mysql DB content on HTML table and every row have "EDIT" and "DELETE" buttons...(HTML "a" tags buttons)
When I click on "Edit" button a pure CSS3 Modal Popup is open, where I need to Edit a record on the row,
If I click on "Delete" button a pure CSS3 Modal Popup is open for delete record confirmation if the answer is "YES" proceed to delete the Record if the answer is "NO" should back to the parent page...
Populate a list of selected records is working. CSS3 Modal Popup is working...
The question is how can I send arguments to the Modal Popup to manipulate the data?
Could someone help with this.
Thanks.
The ways I would do this in no particular order:
Separate modals for every item on the table. Could be cumbersome, and is definitely not efficient, but would get the job done without using Javascript.
Javascript - Have a data-id and data-table attribute in the button. When clicked, populate the modal with Javascript via AJAX.
Javascript - Store table data in JSON array. Use above attributes to access specific elements of the JSON table object.
Javascript - Store the JSON object directly in the data attribute if possible and load up the modal when clicked.
Have a hidden <div> with all the content, and when the button is clicked, transfer the HTML to the modal.
Really there are many other ways to get it done. Pick one that looks easy, efficient, and safe, and give it a go. Post back here when you get stuck and we will be glad to help you.