jquery easyui data grid editor for combo box not loading with grails - grails

I am using Jquery Easyui Datagrid with grails this is my code for creating the grid in GSP file:-
<table class="easyui-datagrid"
data-options="fit:true,idField:'id',pageNmber:1,pageList:[25,50,75,100]" pagination="true" id="importGrid">
<thead>
<tr>
<th data-options="field:'firstName',sortable:true,width:15,nowrap:true" >First Name</th>
<th data-options="field:'lastName',sortable:true,width:25,nowrap:true" editor="{type:'validatebox',options:{required:true}}" >Last Name</th>
<th data-options="field: 'firstNameLastName',sortable:true,width:130,nowrap:true" >First Name Last Name</th>
<th data-options="field:'displayName',sortable:true,rowspan:2,width:80,nowrap:true">Display Name</th>
<th data-options="field:'relocation',sortable:true,width:130,nowrap:true">Relocation</th>
<th data-options="field:'proficiency',sortable:true,width:130,nowrap:true" editor="{
type:'combobox',
options:{
valueField:'rightid',
textField:'rightname',
data:aRights,
required:true
}
}">Proficiency</th>
<th data-options="field:'subProficiency',sortable:true,width:130,nowrap:true" editor='proficiencyEditor'>Sub Proficiency</th>
<th data-options="field:'uploadResume',sortable:true,width:130,nowrap:true,">Relocation</th>
</tr>
</thead>
</table>
i tried using url which refers to one action in controller but it doesn't work.so to make it work with gsp now i am using a js variable which i have declared in the same gsp. I have the variable aRights like this:-
<script> var aRights = [{rightid: 'V', rightname: 'View Only'},
{rightid: 'E', rightname: 'Edit FPC'},
{rightid: 'A', rightname: 'Admin'},
{rightid: 'N', rightname: 'None'}
] ;
</script>
But editor is never visible..
this is the code i am using to populate the data grid.This code is in js:-
$('#importGrid').datagrid({
url:'/'+productName+'/TestList/excelImport',
queryParams:{
list: hiddenMapForFields,
file:fileName
},
pageNumber: 1,
});
I am new to Jquery easyui editors.Please let me know where i am wrong and help me to solve the issue.

I try to reproduce your bug.
http://jsfiddle.net/niscio/63fyrzL8/1/
If you read the documentation the real problem for editing is that you have to use edatagrid declaration
$('#ID').edatagrid({... options ...});

Related

Angular Datatable is not loading on first Load

Here im using DataTable with Angular2 Here DataTable is working wen i refresh the page.But its not loading on 1st Run
<table datatable class="row-border hover">
<thead>
<tr>
<th>Auction ID</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let value of auction">
<td>{{value.name}}</td>
<tbody>
</table>
At The same time i used normal DataTable(Without *ngFor="") its working fine without any issue
<table datatable class="row-border hover">
<thead>
<tr>
<th>Auction ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<tbody>
</table>

Undefined cell value with dynatable table

I'm trying gerenate a interactive table with dynatable. I followed the documentation instructions but i'm still getting "undefined" in all values of two columns. I believe that data-dynatable-ignore="true" is not working and I want to know the right way to do it.
HTML:
<table id="example" cellspacing="0" width="100%" class="dynatable table table-condensed table-hover table-striped table-bordered">
<thead>
<tr>
<th rowspan="2" data-dynatable-column="Unidade">Unidade</th>
<th rowspan="2" data-dynatable-column="Meta">Meta</th>
<th colspan="2" data-dynatable-ignore="true">Inclusão</th>
<th colspan="2" data-dynatable-ignore="true">Confirmação</th>
</tr>
<tr>
<th data-dynatable-column="ValorI">Valor</th>
<th data-dynatable-column="%I">%</th>
<th data-dynatable-column="ValorC">Valor</th>
<th data-dynatable-column="%C">%</th>
</tr>
</thead>
</table>
JS:
$('#example').dynatable({
features: {
paginate: false,
sort: true,
pushState: false,
search: false,
recordCount: false,
perPageSelect: false
},
dataset: {
ajax: true,
ajaxUrl: 'https://api.myjson.com/bins/n4ecd',
ajaxOnLoad: true,
records: []
}
});
JSFIDDLE: https://jsfiddle.net/pvviana/fw69uLus/
After waste a couple hours reading the dynatable documentation documentation I noticed that it's not posible yet. So i moved on Datatables and i already created what i wanted.
I hope dynatable would improve your development possibilities soon.

Kendo UI Grid - issue creating data-id row attributes

I'm working on a Asp.Net MVC 5 Web Pages project, where one of the partial views generates an Html table. It of course mixes the Razor syntax in with Html.
Now I need to implement this table as a Kendo UI Grid, where the HTML table is used as the DataSource (see this as a reference - http://demos.telerik.com/kendo-ui/grid/from-table).
Great so far - and yes, my new Kendo grid does in fact render nicely.
ex/
Only problem is that the Kendo Grid now seems to be overwriting the <tr> data-id attributes I'm injecting into each row.
So how would I turn this into a Kendo rowTemplate ?
Before implementing the Kendo Grid, here is the Html table as rendered:
<table id="summary-table" class="table table-hover table-extra-condensed">
<tr data-id="80" data-nodes="2008-08-08" data-title="EUREX IRS" data-subtitle="All">
<td class="hidden">80</td>
<td><i class="fa fa-chevron-right"></i> EUREX IRS</td>
<td class="text-right">USD</td>
</tr>
<tr data-id="50" data-nodes="2008-08-08" data-title="EUREX IRS" data-subtitle="IRS-EUR">
<td class="hidden">50</td>
<td><span class="indent">IRS-EUR</span></td>
<td class="text-right">USD</td>
</tr>
</tbody>
</table>
Here is the new table, now rendered as a Kendo grid (Kendo added data-uid but I lost my custom 'data-' row attribs):
<table id="summary-grid" class="table table-hover table-extra-condensed" data-role="grid" role="grid">
<tr data-uid="fcc1ffab-f1e7-4ea4-9b79-7c4149bbbfa3" role="row">
<td style="display:none" role="gridcell">80</td>
<td role="gridcell"><i class="fa fa-chevron-right"></i> EUREX IRS</td>
<td role="gridcell">USD</td>
</tr>
</table>
Here's the partial.cshtml file snippet:
#model IEnumerable<WhatifSummaryViewModel>
#{
string guid = Guid.NewGuid().ToString();
}
<table id="summary-grid" class="table table-hover table-extra-condensed">
<thead>
<tr>
<th data-field="id" hidden class="hidden">Id</th>
<th data-field="product">#Settings.Whatif.SummaryPortfolioName1 - #Settings.Whatif.SummaryPortfolioName2</th>
<th data-field="currency" class="text-right">Currency</th>
<th data-field="margin" class="text-right">#Settings.Whatif.SummaryCurrentExposureName</th>
<th data-field="wi" class="text-right hidden-xs">What-If</th>
<th data-field="impact" class="text-right">Impact</th>
<th data-field="chart" class="text-center hidden-xs">View</th>
</tr>
</thead>
<tbody>
#for (int i = 0; i < Model.Count(); ++i)
{
string title;
if (Model.ElementAt(i).SubTitle.Equals("ALL", StringComparison.OrdinalIgnoreCase))
{
title = "<i class='fa fa-chevron-right'></i> " + Model.ElementAt(i).Title;
}
else
{
title = "<span class='indent'>" + Model.ElementAt(i).SubTitle + "</span>";
}
<tr data-id="#Model.ElementAt(i).PortfolioId" data-nodes="#String.Join(",", Model.ElementAt(i).NodeDates)" data-title="#Model.ElementAt(i).Title" data-subtitle="#Model.ElementAt(i).SubTitle">
<td class="hidden">#Model.ElementAt(i).PortfolioId</td>
<td>#Html.Raw(title)</td>
<td class="text-right">#Model.ElementAt(i).Currency</td>
<td class="text-right">#String.Format("{0:#,0}", Model.ElementAt(i).Utilisation)</td>
<td class="text-right hidden-xs">#(Model.ElementAt(i).WhatIfRun ? String.Format("{0:#,0}", Model.ElementAt(i).WhatifExposure) : "")</td>
<td class="text-right">#(Model.ElementAt(i).WhatIfRun ? String.Format("{0:#,0}", Model.ElementAt(i).ImpactToExposure) : "")</td>
<td class="text-center actions hidden-xs"><i class="fa fa-bar-chart"></i></td>
</tr>
}
</tbody>
</table>
and finally, the Kendo grid which is configured in my onReady javascript function:
(NOTE: the rowTemplate below is commented, and certainly does cause a scripting error if uncommented).
// Kendo UI grid
$("#summary-grid").kendoGrid({
resizable: true,
toolbar: ["pdf","excel"],
columns: [
{ field: "PortfolioId", hidden: true },
{ field: "title"},
{ field: "Currency", title: "Currency" },
{ field: "Utilisation", title: "Margin" },
{ field: "WhatifExposure", title: "What-if"},
{ field: "ImpactToExposure", title: "Impact" },
{ field: "Chart", title: "View" }
]
#*rowTemplate: '<tr data-uid="#= uid #" data-id="#= #Model.ElementAt(i).PortfolioId #" data-title="#= #" >'*#
});
In the end, I'd like to add my custom data- row attribs. I was thinking that the kendo template would work, but I can't figure it out in this Web Pages Razor context.
Help is appreciated...
Bob

jquery tablesorter both asc and desc from a single external link

I want to sort both asc and desc direction alternately from the link
Not from the table header
I am not able to figure it out, the code that inserted is working only one direction. I need both directions
plugin :: jQuery plugin:Tablesorter2.0
<table id="myTable" class="tablesorter" border=1>
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Due</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>jsmith#gmail.com</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tbody>
<a id="trigger-link" href="#">I want to sort both asc and des`enter code here`c alternately from this link</a>
<script>
$(document).ready(function(){
$("#myTable").tablesorter();
$("#trigger-link").click(function() {
var sorting = [[0,1]];
$("table").trigger("sorton",[sorting]);
return false;
});
});
</script>
If you are using this fork of tablesorter, you now have two ways to accomplish this:
Trigger a "sort" event on the header cell (v2.9+)
$("table").find("th:contains(Discount)").trigger("sort");
As of v2.17.0, you can trigger the "sorton" method using an "n" (or next) variable
$("table").trigger("sorton", [ [[0,"n"]] ]);
Please see this demo for other sort methods.

How to generate <table> compatible with jQueryMobile in TYPO3

I'm trying to create a jQueryMobile compatible <table> with TYPO3.
It means adding data-role="table" and class="class="ui-responsive"".
This table can be generated with RTE or a Table Content Element.
RTE
Default <table> HTML
<table style="" class="contenttable">
<thead>
<tr>
<th scope="col">head 1</th>
<th scope="col">head 2</th>
<th scope="col">head 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>L 1</td>
<td>...</td>
<td>...</td>
</tr>
<tr>
<td>L 2</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
attempt to solve problem
I've added the following setup but jQuery seams not to work anymore. It load (spinning animation) indefinitely.
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.always = 1
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.default = table
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.default = ui-responsive
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list = ui-responsive
Content Element
Default <table> HTML
<table class="contenttable contenttable-0 test">
<thead>
<tr class="tr-even tr-0">
<th class="td-0" scope="col" id="col162967-0">head 1</th>
<th class="td-1" scope="col" id="col162967-1">head 2</th>
<th class="td-last td-2" scope="col" id="col162967-2">head 3</th>
</tr>
</thead>
<tbody>
<tr class="tr-odd tr-1">
<td class="td-0" headers="col162967-0">L 1</td>
<td class="td-1" headers="col162967-1">...</td>
<td class="td-last td-2" headers="col162967-2">...</td>
</tr>
<tr class="tr-even tr-last">
<td class="td-0" headers="col162967-0">L 2</td>
<td class="td-1" headers="col162967-1">...</td>
<td class="td-last td-2" headers="col162967-2">...</td>
</tr>
</tbody>
</table>
attempt to solve problem
I don't find in tt_content where to add configuration to add a classand data-role.
For the TABLE content element you have at least 2 options:
A. Render the table yourself - You can create your own PHP method that would do the processing of the tables. I presume you are using css_styled_content extension whose method render_table() does the rendering of the tables. You can copy that method, add it to your own class and modify it so that it adds the data-role attribute as you want.
B. Do some replacing of the outputted code - You can try to use the replacement property (available in TYPO3 >=4.6) of the stdWrap to replace class="contenttable with data-role="table" class="ui-responsive. I currently cannot test it but try this:
tt_content.table.20.stdWrap.replacement {
10 {
search = class="contenttable
replace = data-role="table" class="ui-responsive
}
}
There's a bug report open at forge to override the Flexform values via TSconfig TYPO3 forge.
The suggested workaround by overriding the flexform completly works fine though:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:'.$_EXTKEY.'/flexform_table.xml', 'table');

Resources