BootStrap Table With Dynamic Data using Jquery - javascript

I am using a Bootstrap Table with JQuery.
I tried to help myself but still could not get a solution.
Please check out this link.
Here I need the data to be dynamic.
For example, there can be a situation where fields can get created dynamically.
Sometimes there can be three columns and sometimes there can be four columns based on the JSON object.

Related

Html table sorting using JavaScript or jQuery

This is a image of my sample code. I want to sort this table data, column wise when click the each sort button in top in the table. This table contains PHP also.
Number
Date
Three
Five
One
Four
Two
When user click on sort button, entire row should be sorted in acs or desc according to clicked column's data. Column contains words and column 2 contains dates.
Anyone knows that help me please....
Thanks
Can you check jquery datatable plugin. That supports sorting, expanding columns for a table. Please see the link
https://datatables.net/examples/basic_init/table_sorting.html
I would start with this:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_sort_table
It's works just fine, and doesn't require even jQuery, let's alone jQuery plugins.
It's obviously, you should adapt code to sort with different columns names (not just for "Name"), but is easy enough.
You can use table-sorter (a client-side table sorting) and sort the table once after the page loaded. After that each of the columns is sortable by clicking the column header (It is in pure javascript and doesn't need jquery):
http://tablesorter.com/docs
I have used the tablesorter jQuery plugin. It is a light weight and a very good plugin for your needs. I think this will suits to your need.

Jenkins plugin advanced development

I am trying to create an advanced feature in jenkins plugin but no idea where to start.
I wanted to create a table which has dynamically row added with checkbox in one column and get value of those selected checkboxes.
Please help me out for.
a) generate dynamically table.
b) add checkbox in column and get checked value.
After a week of RnD. Jenkins tag library not provided so much control but it has one control that make us happy.
<f:block></f:block>
In this block we can create a table or other html controls.
For dynamically created rows and coloumns we should use javascript in <script /> tag it not requried type like in html.
Guys i tried jQuery but jenkin stapler not allow this, because sign of dollar is used for stapling classes in jenkin.
If you know the data for generating dynamic row then that's ok. but if your data is came from server side then we have to implement ajax functionality.
For ajax functionality in jenkins use this link.
"https://wiki.jenkins-ci.org/display/JENKINS/AJAX+with+JavaScript+proxy"

datatable jquery how to see data of the table in console

I an using datatable by jquery(see documentation https://datatables.net/)
I want to see the attributes of the table, particularly the total count of rows of the table, I want to show this value in the html, How can I do this?
And how can I show the attributes of the tables in the console of chrome?
Add console.log(result);to your JavaScript code, result being the attribute you want to display. I copied that straight from my program so that should work for you. Good Luck.

How would I implement a cascading dropdown list that reads from multiple sql tables? C# MVC

I'm building an mvc web app using C#. The place I am currently stuck is trying to add a cascading drop-down list. I have seen several articles on this, however my usage varies enough that I'm not sure how to implement it.
My information to populate the dropdown lists is coming from a series of sql tables. The first dropdown should show the information from one table (which lists available tables). When the user selects an option, a second dropdown list should be created and filled with the information from the chosen table.
How would I implement this cascading dropdown list which could read from any number of different tables?
I believe this will involve AJAX/javascript which I'm not very familiar with.
To better explain my data structure, this is an application for an administrator to keep track of useful information. There could be several tables such as Employees, CompaniesWorkedWith, ProjectsBeingDeveloped, BudgetItems, etc... Then a final lookup table that would contain these table names. The first dropdown would be populated with information from this lookup table. Then when the user selects an item (such as Employee) the second dropdown would grab the information from the appropriate table and display it in a dropdown. Then the user could select and item (such as an individual employee) which will then grab the details of that item and present it to the user. That last part should be easy. I'm just confused on how to get the dropdowns to cascade through multiple tables. It should be dynamic that someone can easily go in and add another table to the lookup table and have it function properly.
You need to implement callback's to update the data sources for the cascaded controls. Just use your update panels appropriately to prevent full page post-backs. If you're using a framework such as DevExpress, Telerik or ASP.NET then there's lots of options and sample source code for this exact thing.
http://www.codeproject.com/Articles/730953/Cascading-Dropdown-List-With-MVC-LINQ-to-SQL-and-A
EDIT: I realized you're second data-source depends on a second more dynamic data source. To do this I would create my own data-source implmenting IEnumerable. I have a sample of something that may help somewhere... I'll look for it.
EDIT 2:
Okay, I took a look at code similar to this (not quite the same) but here's how you can do it:
You'll need a generic container for your values for your second/third/etc. dropdown lists. This might be a List<string> or a List<MyGenericClass> with whatever properties you are filling out to represent your columns for each row in the dropdown.
Use SqlConnection, SqlCommand to iterate through the results and populate the List (or your own class that implements IEnumerable).
Assign the IEnumerable object to your dropdown list datasource.

Datatables 1.10 - Swap table

In my application I have table that can have multiple columns, based on date range selected.
I need to be able to display table containing 20 columns or 50 columns (number of columns is based on data range from parameters). I did that, but I was refreshing page when my parameters changed.
Now I'm trying to do it better.
I've created sample that shows my approach: http://live.datatables.net/fojusec/3
Basically I'm swapping "table" with new content that comes from ajax request and then I'm calling "dataTable" on that new table.
My example works fine, but I was wondering if maybe there is a better way to do it, maybe by reconfiguring table?
Is it safe to do that like I did it? I'm worried about any leaks.
EDIT:
What I'm not sure is if dataTable object is attached to table. So if I'm removing table from DOM should I be removing dataTable object also.
I would like to avoid any conflicts. I clicked on my example for some time and I didn't got any errors.
QUESTION: What is the best way to swap or reconfigure table using datatables 1.10

Categories