Tabulator - how to call a function when using the built in "list" editor and selecting a list option - editor

I'm new to Tabulator. When using the built in list editor on a column, how would I call a function when one of the list items is selected and get the value of the newly selected list item? I've tried cellClick but it calls the function before I can select an item and cellEdited doesn't fire when the item is selected. Any ideas? Thanks!
Here is the column setup:
{title:"Status", field:"status", editor:"list", editorParams:{values:{"Active":"Active", "Won":"Won", "Lost":"Lost", "Cancelled":"Cancelled"}},cellEdited:function(e, cell){CallSomeFunction(cell);}

Related

How to append a empty row to a list/table which is bound to a OData(List Binding) in sapui5?

I have have a list/table which is bound to a entitySet from OData Model V2. I have a add(+) button on screen on clicking that button a empty row(s) need to be appended to the list/table. After that if I enter any data that should be saved into the backend on clicking of save button.
This is possible using JSONModel, but I want to use the OData model .
Regards,
Suman Kumar
It does work with two way data binding.
You can do that using odataModel createEntry method.
The createEntry expects a parameter, the path to your entitySet that you want to create (It should be something like XXXXset). Imagine the following:
1 - User clicks an "Add" button that renders a dialog Window with some fields and two buttons (save and cancel) for him to add his brand new entity.
2 - On the "open event" before you open the dialog, you create a new entity with the createEntry method. Its return gives you a context that you can bind to the dialog.
that.contextCursoIniciativaEmpregadoASerCriada = that.getView().getModel().createEntry('/CursoIniciativaEmpregadoSet');
that.fragmentCriacaoDadosInicEmpregado.bindElement(that.contextCursoIniciativaEmpregadoASerCriada.sPath);
that.fragmentCriacaoDadosInicEmpregado.open();
3 - The dialog pops up with the bind in place.
4 - The user fills the dialog with the entities properties
5 - The user clicks on the save button and you submit your changes

ViewModel not keeping data on postback

I have a ListBox implemented as below.
#if (Model.SelectListVendorBranchSearched != null )
{
#Html.ListBoxFor(model => model.SelectedVendorBranchLeft, Model.SelectListVendorBranchSearched, new {#class="listbox", #size ="10" })
}
But when the form is posted back the viewModel object does not have the original Data Source that the list was bound to. But it has the selected items posted back.
Is that the right behavior?
Let me try to explain what I am trying to achive.
I am trying to implement the following in ASP.NET MVC.
I have a search functionality that populates a list box say List box A. Now I need to select some items in the List Box A and move the items to another List Box say List Box B. Then do another search that refreshes the List Box A with fresh results. Then again select some more items in the List Box A and append to the items already in List Box B. In the end get the items in the List Box B and save it to DB. How can I do this without any JavaScript?

How to handle default dropdown values using jquery ajax in mvc3?

Based on selection of first dropdown i am binding another drop down values based on first dropdownid value.My question is i given default first dropdown value as "select" but there is no id value for that in second dropdown to get the values.if user selectes "select" in frist dropdown i need to load all values in second dropdown.please tell me how to acheive this?
If you given default first dropdown value as "select" means, at that time disable the second drop down value. If 'country' value equal to 'select' means, at that time disable the 'state drop down'.When we click that country 'select' at that time also call that disable drop down function.
For example HTML view page, country drop down displayed. From that you will get country ID.
$countryID=> From your MVC code you have pass default country ID (default ID)
$countrySelected=$this->getCountryFromName(trim($countryID']));
if ($countrySelected!= ''){
$sVal=$this->getStateList($countrySelected);
$newStateList=array('0'=>'State');
$newStateList+=$this->formatDropdownArray($sVal,'STATE_ID','NAME');
$stateSelected='State';
echo CHtml::dropDownList('STATE_IDD',$stateSelected,$newStateList,array('tabindex'=>9));
}else{
$stateSelected=$defaultState;
echo CHtml::dropDownList('STATE_IDD',$stateSelected,$stateList,array('tabindex'=>9));
}

sj:select tag in struts2-jquery plugin calls the JSON method again when the page gets submitted for a different action

This question is on Struts2 jquery plugin. While loading a JSP be default I am loading one dropdown list values and the second dropdown values are loaded based on selection of first dropdown. When the second dropdown value is selected an onChange event get executed and the page is getting refreshed. When the page is refreshing the First dropdown is getting called again! Is there anyway to avoid the second time execution of default loading of firstdropdown and also need to hold the selected values for both the submitted dropdown values of the JSP?
Note: First dropdown and second dropdowns are evaluated in SampleAction.java and onChange event executes LoadAction.java
Please let me know if you require further details!
Thanks
An option from the first dropdown is selected
Second dropdown is filled accordingly and then a value is selected
Instead of page-refresh, you can submit a form passing the values of both select tags
Now you get the selected values in your action and then you can show the same page but with prefilled values. This time when the page loads, the first select box by default shows the same previously selected value.
For the second select to show the previously selected value, you'll have to write some javascript code which will select the previously selected value.

I want to Dynamically Create Select list when i click a button by using struts2 tag?

I want to Dynamically Create Drop down list when i click a Button and the value selected in the Drop Down List should be inserted into the Database The Drop Down List should be in Struts2 Tag.
function addDropDown(parent){
var myselect = document.createElement("select");
myselect.setAttribute("name","someName");
myselect.onchange=function(){ submitvalue(this.value) };
theOption=document.createElement("OPTION");
theText=document.createTextNode("text gere1");
theOption.appendChild(theText);
theOption.setAttribute("value","value here1");
myselect.appendChild(theOption);
theOption=document.createElement("OPTION");
theText=document.createTextNode("text gere2");
theOption.appendChild(theText);
theOption.setAttribute("value","value gere2");
myselect.appendChild(theOption);
theOption=document.createElement("OPTION");
theText=document.createTextNode("text gere3");
theOption.appendChild(theText);
theOption.setAttribute("value","value gere3");
myselect.appendChild(theOption);
parent,appendChild(myselect);
}
call this function onClick of your button with some parent element(form or div) as argument.The function submitvalue() will be called on selection of any element of the dropdown, do your database submit action there(submit using ajax or whatever you are using as you have not mentioned it). I also noticed you have mentioned that the dropdown should be in struts2 tags, icouldnt wonder why as even the static struts2 tags get changed to html tags when executed

Resources