I got a case to make column insert using appendgrid.
In my case, I need insert data with LOV (list of values) or any plugin to appendgrid column.
Then my question is how to send data from LOV (or any plugins) to apppendgrid column.
Example below.
Thank you.
You didn't really supply any more useful information, so the best guess I have is the following (using the documentation):
$(function() {
$('#tblAppendGrid').appendGrid({
// Object containing the definitions of the table rows
initRows: RowDefinitons,
// Your LOV Data
initData: LOVData
});
});
Related
I would like to find a way of writing a SELECT statement which includes using the column name as a search criteria in a data_glossary table.
Example SQL statement
SELECT field1, field2, field3
FROM table1
I want to include field_definition from a table called tbl_data_glossary using WHERE data_reference = 'field1' whenever I run a script. So I should get two data sets, the first one has the data, the second has what the data set values mean.
I hope that makes sense, I want to implement this in a way where a BI tool could not only pull values but include the information required to provide help for business users.
I have tagged this as SQL and Javascript but maybe you have a better way of approaching this.
I wonder if I need to setup my select statement using an array of variables somehow and then also use the same array in a WHERE data_reference IN [array] type statement.
So, if one of the fields in my SELECT statement is reference_definition_name I want a sub query or separate query to look up that column name as a value which is held in the column called reference_code in tbl_reference_data
Here's the tbl_reference_data table which contains the data glossary with example data:
(reference_def_id,
reference_def_name,
reference_def_created,
reference_def_last_updated,
dataset_category,
dataset_type,
reference_code,
reference_name,
reference_description,
reference_status,
reference_lang)
Example data:
('8f603ffe-6800-11ea-bc55-0242ac130003', 'Data Origin Identifiers', '17/03/2020 16:34', '17/03/2020 16:34', 'Reporting', 'data-glossary', 'reference_definition_name', 'Definition Name', 'This is the name of the reference data set related to the purpose of the reference definitions.','ACTIVE','EN')
Thanks, Matt
When we build the HTML on server-side and only then apply DataTables, we can place the raw data in data-sort attribute and the formatted value on the cell's text, and it will properly sort the column.
I'm in such need, but data is coming as json, and I'm adding it as DataTable({data: object}).
I'm using columnDefs-render to format those values, and as we know DataTables uses the rendered string instead of raw data to sort.
I'd need some columnDefs setting to provide the raw data for sorting, but can't find how. Any ideas?
I figured it out!
1) On the web service response, make sure there's a field with the proper data type to be used on the sorting. In case (not best practice) the data is being formatted to string on the application and not by DataTables, add a field for the formatted string and another field for the proper data type
2) On DataTables settings, columns area, set as usual the proper column linked to the proper field
3) if DataTables is responsible for formatting, as usual, add the render setting for doing it
4) back to the columns area, add a new column on the end of the list, linked to the proper data type field, and add visible: false to it, this way this column will be available for other settings and functions to use, but won't be rendered visually
5) on columnDefs area, add { "orderData": 8, "targets": 5 }, this way when the column 5 is ordered, DataTables will use column 8 instead to do it, being column 8 the new invisible column added on (4)
I'm working with DataTables and i'm trying to search a result in a table with a dropdown. But rather than searching one column, I need to search in two specific columns.
The below syntax works with a single column but how do i do it with multiple columns?
var table = $('#example1').DataTable();
$("#filter").on('change', function() {
table.column([4]).search($(this).val()).draw();
});
I tried doing this but when i use this code it only searches the result in the first column, E.g. 4th Column. and ignores the rest.
table.column([4,5]).search($(this).val()).draw();
What is the proper method for this?
Lets summarize all things here. It will help other people as well.
You can achieve this as follow:
table.column(4).search(this.value).column(5).search(this.value).draw();
It will perform search on 4 column (4 is index of column), after that it will filter data from 5 column against provided filter value and at the end it will draw the table.
One thing to keep in mind is that Filter is applied on both columns, so both columns must contains matching data.
Here is its filddle
This can be achieved by using fnMultiFilter as it documentation explains:
This plug-in adds to DataTables the ability to set multiple column filtering terms in a single call (particularly useful if using server-side processing). Used in combination with the column sName parameter, simply pass in an object with the key/value pair being the column you wish to search on, and the value you wish to search for.
Use columns() in place of column():
var table = $('#example1').DataTable();
$("#filter").on('change', function() {
table.columns([4,5]).search($(this).val()).draw();
});
From the doc, you should be using .columns() (note the plural)
For an OR search among multiple columns, disable columns for the search using
columns.searchableSince: Enable or disable search on the data in a certain column.
Alternatively, you can also use an HTML attribute to remove the column from the search
<th data-searchable=false>
I have 10 columns (C1, C2...C10) in the data array. What I want is to have all the columns in the background but display only C1 to C5 to the user. The reason: In the validations part, I need to have these hidden fields to find whether the values typed in visible columns are valid or not. I am using javascript on a button click outside the handsontable definition for these validation.
What I did currently is to define the data array with values for ALL 10 columns and while defining the new handsontable statement, used columns [ ] tag to display only the columns to be visible. (In the columns section, I have inserted only C1 to C5 and did not include C6 to C10). Now the problem is that, when In used .getData() to get the dataset, the hidden columns (on other words the columns not included in the columns [ ] tag of the handsontable definition) are coming as undefined, when accessing using
var gettablearray = handsontable1.getData();
window.alert(gettablearray[rowindex][columnindex]);
Is this is achievable though an existing straight forward official way? Or please advice what could be a work around.
Thanks in advance.
The nice way
You can refer to your data array whenever you check any data. Assuming you are enabling sorting, the best way is to use the sortIndex method which translates from the view data row to the original data index:
physicalIndex = instance.sortIndex[logicalIndex][0];
The ugly way
Render all 10 columns, then hide columns 6-10. This way you can access all data on the same level.
I am using the DataTables API for my table in the application. I have a scenario where I want multiple columns be enabled for filtering purpose.
I have this code setup now. But it only searches for Column2. Even if I enter value for Column1 it doesn't search.
$('#btnFilter').click(function () {
table.fnFilter($('#Column1').val());
table.fnFilter($('#Column2').val());
});
i guess fnFilter will also accepts iColumn paramter
so try using like this
table.fnFilter($('#Column1').val(), 0); //0 is the first column
table.fnFilter($('#Column2').val(), 1);