Having a dumb, I think. What's the v4 version of this:
var table = $("#eventsGrid");
var events = table.getData;
where #eventsGrid is a populated Tabulator.
Basically on submitting a form I want to grab all of the data in a Tabulator instance.
TIA,
Paul
When you initially define a Tabulator it returns the object to use for this
var table = new Tabulator("#eventsGrid", {... your setup options ...});
You then use this variable to call functions on
var events = table.getData();
You can't look it up by selector like jQuery
There is a conversion guide for migrating from 3.5 to 4.0 here:
http://tabulator.info/docs/4.0/upgrade
Related
We can create object and then refer to it via table variable. Like this:
var table = new Tabulator("#example-table", { ... } );
But is there a way to get Tabulator object by selector, like in jQuery:
$( '#example-table' ) // Tabulator("#example-table")
Which will not construct new Tabulator but just return existing object.
If you want to use jQuery with tabulator 4.0 and above you just need to use the jQuery Wrapper
$("#example-table").tabulator( ... )
A full guide to using this can be found Here
I have a nested tabulator which I created in the following manner :
var Col= row.getCell("column").getElement();
var SubTd = document.createElement("td");
Col.appendChild(SubTd);
var subTable = new Tabulator(SubTd, {
data:row.getData().Xpaths,
columns:[{field:"Value",editor: true}]
})
I want to give an ID to 'subTable'. How should I do it? I read the documentation but can't find.
I am using Version 4.1.
You are creating a standard DOM node with the line:
var SubTd = document.createElement("td");
So to set the id you use the id property on the node:
SubTd.id = "whatever-id-you-want-to-use";
Though it would generally be considered bad practice to do this if you are adding a sub table for each row in the table as id's should be unique on the page and should not be duplicated.
If you want to do this for styling purposes you would be better of doing this in a class:
SubTd.classList.add("your-style");
As am totally new to YUI i dont have any clue about.I have just gone through this link to implement autocomplete using YUI http://developer.yahoo.com/yui/autocomplete/.
According to my requirement i need to assign a string array dynamically to datasource object instead of
var dsLocalArray = new YAHOO.util.LocalDataSource(["apples", "broccoli", "cherries"]);
something like
var dsLocalArray=new YAHOO.util.LocalDataSource(documentList[]);
where my documentList is String Array.How do i that?Thanks in advance for the help.
I would suggest you to use YUI3 than YUI2, the example you are showing which uses the YAHOO namespace which is YUI2.
YUI3 is simpler and better, you can get the docs here:
http://yuilibrary.com/yui/docs/autocomplete/
Example of implementing with YUI3 including highlighting feature:
YUI().use('autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', function (Y) {
Y.one('#ac-input').plug(Y.Plugin.AutoComplete, {
resultFilters : 'phraseMatch',
resultHighlighter: 'phraseMatch',
source : ['Alabama','Alaska','Arizona','Arkansas','California']
});
});
Try to lok into the examples at the right bottom side panel in the above docs link.
I have a querySaveDocument function for my xPage where I set up some backend fields, including Authors and Readers fields.
var authors = new Array("[AdminEditors]");
var user:String=session.getEffectiveUserName();
authors.push( user );
var authitem:NotesItem = doc.replaceItemValue("z_Authors", authors );
authitem.setAuthors(true);
var readitem:NotesItem = doc.replaceItemValue("z_Readers", "[AdminReaders]" );
readitem.setReaders(true);
I thought doc.replaceItemValue() would return a reference to the NotesItem, but authItem is null.
So how does one create a field on the backend Notes Document using SSJS and get a reference to it?
Thanks,
-- Jeff
Make sure to use getDocument(true) to have the backend document synced with changes made in the frontend document.
var doc = document1.getDocument(true);
In YUI 3 I have a node that is my select box:
Y.get('#regionSelect');
How do I get the <option> values that are currently selected (even if there are more than one?) Also, is there a tutorial out there that tells me explicitly how to do this (I don't want to serialize a whole form)?
Once you have the selector, you can chain get and each
Y.get("#regionSelect").get("options").each( function() {
// this = option from the select
var selected = this.get('selected');
var value = this.get('value');
var text = this.get('text');
// apply secret sauce here
});
I've just been using the demos/examples on http://developer.yahoo.com/yui/3/ to figure things out.
// Selected Value
Y.one('#regionSelect')._node.value;
Y.one('#regionSelect').get('value');
// Selected Index
Y.one('#regionSelect')._node.selectedIndex;
Y.one('#regionSelect').get('selectedIndex');
You might not need to iterate through all options if you need just a selected one:
var index = Y.get("#regionSelect").get('selectedIndex');
var value = Y.get("#regionSelect").get("options").item(index).getAttribute('value');
You can directly use this. Require selector-css3 module to support IE.
YUI().use("selector-css3", "node", function (Y) {
var text = Y.one("#ownerSelector option:checked").get("text");
});
http://jsfiddle.net/neosoyn/r8crW/