How to add checkbox column in vue-tables-2? - vuejs2

I have list of users table created in vue-tables-2. I want to add checkbox column before each row to select multiple row and before header to select all row like gmail.
can anyone help me out ?

it is very simple.
you should add a column to your vuetables column, just this.
imagine you are defining your tables column in fileds variable.ok ?
i mean something like below,just put this code inside your table coulmn:
fields: [
{
name: '__checkbox',
titleClass: 'center aligned',
dataClass: 'center aligned'
},
//...
]
if you wana get more information take look at this link:
https://github.com/ratiw/vuetable-2-tutorial/wiki/lesson-11

Related

How to use a function in select along with all the records in Sequalize?

Here is a Sequalize query below which retrieves a transformed value based on the table column value.
courses.findAll({
attributes: [ [sequelize.fn('to_char', sequelize.col('session_date'), 'Day'), 'days']]
});
The above sequlaize query will return result equal to as followed SQL query.
select to_char(bs.session_date, 'Day') as days from courses bs;
Expected output:
I want the transformed value which is in attributes along with all records like below. I know we can mention all the column names in attributes array but it is a tedious job. Any shortcut similar to asterisk in SQL query.
select to_char(bs.session_date, 'Day') as days,* from courses bs;
I tried the below sequalize query but no luck.
courses.findAll({
attributes: [ [sequelize.fn('to_char', sequelize.col('session_date'), 'Day'), 'days'],'*']
});
The attributes option can be passed an object as well as an array of fields for finer tuning in situations like this. It's briefly addressed in the documentation.
courses.findAll({
attributes: {
include: [
[ sequelize.fn('to_char', sequelize.col('session_date'), 'Day'), 'days' ]
]
}
});
By using include we're adding fields to the courses.* selection. Likewise we can also include an exclude parameter in the attributes object which will remove fields from the courses.* selection.
There is one shortcut to achieve the asterisk kind of selection in Sequalize. Which can be done as follows...
// To get all the column names in an array
let attributes = Object.keys(yourModel.rawAttributes);
courses.findAll({
attributes: [...attributes ,
[sequelize.fn('to_char', sequelize.col('session_date'), 'Day'), 'days']]
});
This is a work around there may be a different option.

How to retrive information from a json substring in a json column in sql query

I have a table that looks like this:
[type] [localid] [data] [executed by]
in the data column there is json
{
"type":"music",
"local_id":"00000086",
"recording":{
"album":null,
"title":"null",
"local_id":"OUHA_A46013SG0001",
"composers":[
"null"
],
"label_name":"null",
"main_artist":"null",
"production_country":null
},
"starts_at":null,
"parallel_hash":"8fe1dfd71f8c19be83806455d5194532",
"report_id":"6bd9e074-5f38-402f-a706-7916def5a9e1",
"duration_in_seconds":120.4
}
i am able to retrive all information into a column for every information except i cannot seperate the information in the recording {}.
I have used select data::json->>'type' as type, and so on... and have got the info
[type][localid][recording][starts_at][report_id][duration_in_seconds]
but i also want the information seperated in the recording data. so that the result is
[type][local_id][recording_album][recording_title][recording_local_id][recording_composers][recording_label_name][recording_main_artist][recording_production_country][starts_at][parallel_hash][report_id][duration_in_seconds]
Can anyone show me how?
Found it out using this....
data::json->'recording'->>'album' as album,
data::json->'recording'->>'title' as title,
and so on

Json Expression stored in one column

I have a Json expression stored in one column in the database. I'm looking to separate/parse out the data to display in multiple columns. Some help Please!
Example is below:
"{\"TransactionHeader\":
{\"BinNumber\":\"000000\",
\"Version\":\"D0\",
\"TransactionCode\":\"B1\",
\"ProcessorControl\":\"PBMICCCE\",
\"TransactionCount\":\"01\",
\"ServiceProviderQualifier\":\"07\",
\"ServiceProviderId\":000000,
\"DateOfService\":\"2/20/1701\",
\"VendorId\":\"\"
},
\"Insurance\":
}"

NetSuite sublist column order (suitescript 2)

Is there any way to add a sublist field via a user event script and define its column position? By default the field is added as the last column. It appears you can move form fields around, but can't change sublist column order.
We can able to edit sublist column postion.
But it can be vary based on your records either transaction or suitlet script or any other things just elaborate your question pls.
// For This Example we create a first Field
var field1 = form.addField({
id : 'textfield1',
type : serverWidget.FieldType.TEXT,
label : 'Text'
});
// For This Example we create a first Field
var field2 = form.addField({
id : 'textfield2',
type : serverWidget.FieldType.TEXT,
label : 'Text'
});
form.insertField({
field : field2,
nextfield : 'textfield1'
});

yadcf: possible to use mData from another column?

Here's a simplified version of my code:
$('#myTable').dataTable({
"ajax" : myURL + "/GetTableData",
"aoColumns" : {
{sTitle: "ID", bVisible: false},
...
{sTitle: "Full Name",
mData: null,
mRender: function (data, type, arrRowData) {
return mergeName(arrRowData[3],arrRowData[4],arrRowData[5])
}
},
...
{sTitle: "Column 10", mData: 14},
},
"aaSorting" : [ 0, 'desc']
}).yadcf([{ column_number: 10 }]);
The problem is, I have several columns with bVisible: false which are not displayed, plus custom-defined columns such as "Full Name" above. Because of this, the mData index does not correspond to the actual displayed column index. I want to display the filter for "Column 10" (which is really column 14 in the row data), but the data that it's trying to filter is from column index (mData) 10, not 14. How can I specify the display column and the actual data column separately - is this possible? The only workaround I found so far is to hardcode the filter choices and pass them to yadcf using data: [...], but this approach is obviously suboptimal and only works in a limited number of scenarios.
Editing to add (maybe this is easier): how would I create a filter for the "Full Name" column so that the filter choices are correct? Right now it only shows the first name (arrRowData[3]) because it apparently assumes that the original row data IS the whole column. But the strange part is, the filter does work on the whole column - so if I select "John" from the dropdown, it finds both John Smith and Bill Johnson.
You can place your filters inside a container div / span and point yadcf column definition with filter_container_id or filter_container_selector , you can place your container anywhere you want (including table header)