Tabulator: Have a value associated with cell - tabulator

I am deciding to use this wonderful Tabulator js library but I want to have a different value associated with each cell value that is displayed.
Like
<td value="1">Bob</td>
I see the below options for setting a drop down
columns:[
{title:"Name", field:"name", editor:"select", editorPramas: names
]
where names = { 1: 'Bob', 2: 'Jack'}
however this results in bob and Jack being displayed in the drop down and when Bob is selected it displays 1 in the cell value. However I want Jack and Bob to be in dropdown and when Bob is selected data cell gets value of 1 because I have columns values mapped to IDs which need to be stored in database.

This can be done by custom editorParams
columns:[
{title:"Name", field:"name", editor:"select", editorPramas: myCustom
]
var myCustom = function(cell) {
cell.getElement().setAttribute("value",2);
...
}
whereby one can get the cell element which is changed and accordingly change any attribute of it.

I believe this feature should be considered and generic in the next release.
I proposed a hack for the input editor but this should be done in a generic way with the new parameter elementProps
https://github.com/olifolkerd/tabulator/issues/1869

Related

PowerApps compare Table values to Text

I have a collection with job titles and question id's called colFunctions. I want to compare the job titles in the collection to a single known job title (a text value) and return a list of question id's.
So for the function Jr. System Administrator I want to get a list with ID's of Q01 and Q03, but not Q02.
I have this so far, but it says I can't compare a table to a text value. How can I overcome this?
ClearCollect(
colMatchedFunction,
Filter(colFunctions,Function = Office365Users.UserProfileV2(galleryDirectReports.Selected.userPrincipalName).jobTitle).QuestionID
);
If Function is a text column in SharePoint, or a multi-select choice column? If it is a text column, you can use the in operator, which can check if a the text contains the given id:
ClearCollect(
colMatchedFunction,
Filter(
colFunctions,
Office365Users.UserProfileV2(galleryDirectReports.Selected.userPrincipalName).jobTitle).QuestionID in Function
));
In a multi-select choice column, you can still use the in operator, this time to check if a value belongs to a table, checking it against the 'Value' property of the multi-select column (which returns the text value represented by the choice):
ClearCollect(
colMatchedFunction,
Filter(
colFunctions,
Office365Users.UserProfileV2(galleryDirectReports.Selected.UserPrincipalName).jobTitle
in Function.Value
));

Tabulator 5.2 New editor List option/value

In the new tabulator v5.2, the editor "select" was changed to "list", I have this code that was working fine in v5.1 but stop working in the new version, I hope someone can help me figured out what do I need to change to make it work again with this new version of tabulator.
Ex: in my table there are two columns with select dropdown values, the second column is dependent on the first. So if I select "Sales" in the first column, in the same row on the second column it will only show a list of "services" that belongs to the "Sales" department and so on.
In the code linked below you can see that in the first column when I click in a row in the "Dept" column, a list of values shows up, and if I select the value "Sales" it change to option "1".
{title:"DEPT", field:"dept", width:90, hozAlign:"left", editor:"list", editorParams:{values: {1:"Sales",2:"Service",3:"Bodyshop",4:"Carwash"}}},
{title:"WORK Type", field:"service", editor:"list", editorParams:{values: serviceList}},
jsfiddle
You can use the built-in lookup formatter to do that:
columns:[
{title:"DEPT", field:"dept",
width:90, hozAlign:"left",
editor:"list",
editorParams:{
values: {1:"Sales",2:"Service",3:"Bodyshop",4:"Carwash"}
},
formatter:"lookup",
formatterParams:{
1:"Sales", 2:"Service", 3:"Bodyshop", 4:"Carwash"
}},
Passing the same object of editorParams into the formatterParams would do your job.
Working Demo: https://jsfiddle.net/Mahesh1312/rzbxvym7/5/
Hope it helps!

Tabulator update column position programmatically?

Is it possible to update column position with Tabulator?
Or is there a way to do it?
Apparently there is no function to do it.
A moveColumn function will be coming in the 4.2 release next week.
In the mean time you can easily change the order of columns in the table by calling the deleteColumn function and then the addColumn function.
//remove column
table.deleteColumn("age");
//add column elsewhere in the table after the name column
table.addColumn({title:"Age", field:"age"}, "name");
or by changing the column definition array and resubmitting it using the setColumns function
//define new column layout
var columns = [
{title:"Name", field:"name"},
{title:"Age", field:"age"},
{title:"Gender", field:"gender"},
]
//replace all columns
table.setColumns(columns);
Full documentation on these features can be found in the Columns Documentation

Kentico - Form Control Drop-down List & SQL Query

I couldn't make the title clearer, but here's what I need help with.
I have a custom page type [1] for Leaders which includes 2 fields: Name, and Title. This holds the list of all leaders at the company.
I have another custom page type [2] for Speaking Events, which includes a field called Speaker to display the speaker's name and title. This field was set up as a drop-down list with data source from a SQL Query to query the Leaders data in [1].
Select LeadersID, Name, Title from co_leaders order by Name
I got it work fine - the drop-down displays a list of Name. However, what I wanted to display in the drop-down option is: Name, Title (not just Name) like below so that I only pick one and have both Name and Title. Is it possible to do this?
John Doe, CEO
Jane Doe, CFO
Hope it's clear and thanks for your input!
This is the SQL you are looking for:
SELECT LeadersID, Name + ', ' + Title FROM co_leaders ORDER BY Name
You need to do a concatenation of the column values (Name and Title), as opposed to selecting the columns separately.
EDIT: This is assuming that Name and Title are not nullable fields.
If there is a NULL value in any of the concatenated fields, the end value will be NULL. In this case, you will need to use COALESCE (or an equivalent function) to define an alternative value. For example:
SELECT LeadersID, Name + ', ' + COALESCE(Title, 'Member') FROM co_leaders ORDER BY Name

ExtJS 4.2 Change Group by this column

By default my ExtJS 4.2 Grid is grouping correctly.I want to know the event that is called when we click Group By This Field in ExtJS 4.2.I want to get the column value on this grouping has to be done and save the column field in the database.
I'm not sure if I understand you correctly, but let's give it a shot.
The following event is fired when changing the grouping of a grid.
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.Store-event-groupchange
store.on('groupchange', function (store, groupers) {
// group values available here
var values = store.groups.keys;
// name of the column currently grouped by
var columnField = groupers.keys[0];
// then do whatever you want with these values
});

Resources