jQWidgets Forums
jQuery UI Widgets › Forums › Grid › addrow – issue
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 8 months ago.
-
Authoraddrow – issue Posts
-
Hi,
I have two grid jqxGrid and jqxfilselgrid. jqxGrid has list library name, file name, text and etc. My requirement is to populate the jqxfilselgrid when i double click on any row of jqxGrid. Also jqxfilselgrid is same as jqxGrid but with less columns.here i below declaring an empty grid “jqxfilselgrid”
var data = ‘[{}]’;
var source ={
datatype: “json”,
datafields:
[
{ name: ‘com’, type: ‘string’ },
{ name: ‘flib1’, type: ‘string’ },
{ name: ‘fname1’, type: ‘string’ },
{ name: ‘ftext1’, type: ‘string’ },
{ name: ‘ftype1’, type: ‘string’ }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);$(“#jqxfilselgrid”).jqxGrid({
theme: ‘arctic’,
width:660,
columnsresize : true,
selectionmode: ‘singlerow’,
autoheight: true,
columns: [
{
text: ‘Comd’, align: ‘right’, columntype: ‘button’, datafield: ‘com’, width:20, source: dataAdapter,
renderer: function () { return ‘‘},
cellsrenderer: function (){return ‘X’},
buttonclick: function(test) {
var id = $(“#jqxfilselgrid”).jqxGrid(‘getrowid’, test);
var commit = $(“#jqxfilselgrid”).jqxGrid(‘deleterow’, id);
var rowcount = $(‘#jqxfilselgrid’).jqxGrid(‘getrows’);
}
},
{ text: ‘Library’, width: 70, datafield: ‘flib1’},
{ text: ‘File Name’, width: 100, datafield: ‘fname1’},
{ text: ‘File Text’, width: 150, datafield: ‘ftext1’},
{ text: ‘File Type’, datafield: ‘ftype1’}
]
});
After double clicking of jqxGrid row, it should add to jqxfilselgrid
$(‘#jqxGrid’).on(‘rowdoubleclick’, function (event){
var args = event.args;
var row = args.rowindex;
var datarow = $(“#jqxGrid”).jqxGrid(‘getrowdata’, row);
var rows = $(‘#jqxfilselgrid’).jqxGrid(‘getrows’);
if (rows.length < 3){
if (datarow.flib != null ){
filselrow=new Array();filselrow[“com”] = ‘X’;
filselrow[“flib1”] = datarow.flib
filselrow[“fname1”] = datarow.fname
filselrow[“ftext1”] = datarow.ftext
filselrow[“ftype1”] = datarow.ftype
$(“#jqxfilselgrid”).jqxGrid(‘addrow’, null, filselrow);
}
}else{
document.getElementById(“errmess”).innerText = ‘Only 3 files are allowed to select. Press “Ok” to continue’
$(‘#eventWindow’).jqxWindow(‘open’);
}
});The problem is the rows are not added. but when i alert the fileselrow.flib1 and rest fields i can see the data in it. the addrow is not working
can anyone please help
Hi Adarsha,
The row is an Object, not an Array. You shouldn’t create a row using filselrow=new Array();
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.