jQWidgets Forums
Forum Replies Created
-
Author
-
May 2, 2014 at 6:35 am in reply to: coloumn index and coloumn text in create editor call back coloumn index and coloumn text in create editor call back #53865
hi peter,
i agree with you. in my case, i am populating grid coloumns and datafields dynamically for which i am getting the data from the server. so, we are not sure about the coloumn text and datafield as they will be populated in loop. and editor will be called onclicking the cell, so at that time i need to find the text in coloumn header so that i can write logic there based on the coloumn name as per my requirement. here is the sample..
var colDataFieldArray =[“userName”,”emailId”,”company”,”Flag”];//This is the array which contain Dynamic column datafields first set
for(var i=0;i<(colDataFieldArray.length);i++){
var colStr = $.trim(colDataFieldArray[i]);
gridColumns.push({ text:$.trim(colDataFieldArray[i]), dataField: colStr, editable:false, align : ‘center’, cellsalign:’center’,width: 150});
dataFieldColumns.push({name:colStr, type: ‘string’});
}gridColumns.push({text: “User Id”, dataField: “userId”, hidden:true, cellsalign:’center’});
dataFieldColumns.push({name: “userId”, type: ‘string’});// coloumns for second set to perform editor operation
for(var i=0;i<(serviceArray.length);i++){
var colStr = $.trim(serviceArray[i]);gridColumns.push({ text:$.trim(serviceArray[i]), dataField: $.trim(serviceArray[i]),align : ‘center’, editable:true,cellsalign:’center’, width: 150,columntype: ‘dropdownlist’,
createeditor: function (row, cellvalue, editor, celltext) {
var list = [cellvalue,”none”]; // here in place of cell value i want the column header texteditor.jqxDropDownList({ autoDropDownHeight: true, source: list, promptText: “Please Choose:” });
},geteditorvalue: function (row, cellvalue, editor) {
// return the editor’s value.
return editor.val();
}
});dataFieldColumns.push({name: $.trim(serviceArray[i]), type: ‘string’});
}here, i am populating two sets of coloumns as you can see. for the secong set i v=have to perform editor operation. if i try to get the datafield value , obviously its showing undefined, so i suggest you can add one more parameter so that to get the coloumn header text or value.
hope you understand my problem.Thanks in advance
hi Dimitar,
if we dont want this uid to export when we use export data, what should we do..
Thanks
May 1, 2014 at 10:25 am in reply to: Wrong row(s) selected after multiple rows deleted Wrong row(s) selected after multiple rows deleted #53821hi genechka,
i too faced the same problem before, but we shouldn’t blame the natural behaviour of the grid since it was designed keeping the other functionalities in view as well. i found a sloution for myself which i can share with you. hope it helps..
var rows = $(“#jqxgrid”).jqxGrid(‘selectedrowindexes’);
for (var m =rows.length-1; m >=0; m–)
{var selectedrowindex = rows[rows.length – m – 1];
if (selectedrowindex >= 0) {
var id = $(“#jqxgrid”).jqxGrid(‘getrowid’, selectedrowindex);
deletedata[i]=id;
}
i++;
}deletedata=deletedata.sort();
for (var k=deletedata.length-1; k>=0;k–){
$(“#jqxgrid”).jqxGrid(‘deleterow’,deletedata[k]);
}$(“#jqxgrid”).jqxGrid(‘clearselection’);
selected row indexes method works with the order in which you have selected the rows, and it might not be in sorted order. pls try this.
Thanks.
hi madhuri,
give selection mode as single row. since you are giving checkbox as another coloumn implicitly, you need not to give selection mode as check box. and using this checkbox coloumn for selecting and unselecting rows.. initiate cellbeginedit and cellendedit functions as follows after grid definition.
$(“#jqxgridForFieldSec”).bind(‘cellendedit’, function (event) {
if (event.args.value) {
$(“#jqxgridForFieldSec”).jqxGrid(‘selectrow’, event.args.rowindex);
}
else {
$(“#jqxgridForFieldSec”).jqxGrid(‘unselectrow’, event.args.rowindex);
}
});i would also recommend you to initiate ‘clearselection’ event after removing the selected rows in grid.
$(“#jqxgridForFieldSec”).jqxGrid(‘clearselection’);
hope it helps..
April 29, 2014 at 2:47 pm in reply to: multi select dropdown in grid with change in visibility multi select dropdown in grid with change in visibility #53728Hi peter,
Thank you. its working.
April 27, 2014 at 10:59 am in reply to: Create jqGrid Column Dynamically Create jqGrid Column Dynamically #53616hello anandbabu,
i used your method to create dynamic coloumns. i tried to implement cellserenderer function , but its not working. is there any way to implement cells renderer with dynamically generated coloumns. here is the sample of my code.
gridColumns.push({ text:$.trim(colDataFieldArray[i]), dataField: colStr, cellsrenderer: cellsrenderer , align : ‘center’, cellsalign:’center’, width: 150});
and how can we give different properties for different coloumns i.e, different width for each coloumn. as per your code all coloumns will get same properties, i also want to add hidden coloumns.
pls help..
thanks
April 21, 2014 at 11:09 am in reply to: multi select dropdown in grid with change in visibility multi select dropdown in grid with change in visibility #53342hi peter,
actually the issue is , in your example data for the grid and jqxdropdown are associated. data for the dropdown is populated from the datafield fron the same local data. but in my case grid data and dropdown data are entirely different. how can i populate values in an array which is independent of grid data(and datafields) into jqxdropdown. the datafield for which i have to implement dropdown have no data in local data, infact its not a datafield of that local data. and pls let me know the significance of display member in coloumn definition. and is there any way i can restrict this event to single click instead of double click.
thanks
April 20, 2014 at 12:10 pm in reply to: multi select dropdown in grid with change in visibility multi select dropdown in grid with change in visibility #53311hi Peter,
thanks for reply and i implemented the same with my requirement, but am facing some problems.
i defined the function as
var getEditorDataAdapter = function (datafield) {
alert(“we are in editor”);
var source =
{
localdata: servicesArray,
datatype: “array”,
datafields:
[
{ name: ‘service’, type: ‘string’ },]
};
var dataAdapter = new $.jqx.dataAdapter(source);
return dataAdapter;
}and in services array i have data like “one”,”two”
using this i am getting no error but the values are not getting displayed in dropdown, only two check boxes were visible.
i tried it by giving json data as..
var getEditorDataAdapter = function (datafield) {
alert(“we are in editor”);
var source =
{
localdata: data,
datatype: “json”,
datafields:
[
{ name: ‘service’, type: ‘string’ },]
};
var dataAdapter = new $.jqx.dataAdapter(source, { uniqueDataFields: [datafield] });
return dataAdapter;
}and in data i have [{“service:[“one”,”two”]”}]
by doing so.. its throwing error.
pls help me.
thanks
April 1, 2014 at 11:40 am in reply to: export only selected coloumn's of grid to excel export only selected coloumn's of grid to excel #52325thanks..
March 31, 2014 at 1:49 pm in reply to: image and data in single cell in grid image and data in single cell in grid #52255Hi peter,
Thanks for your quick reply. its working fine
Thanks
March 28, 2014 at 10:03 am in reply to: Export Grid data to excel, PDF, CSV Export Grid data to excel, PDF, CSV #52131hi peter,
i a using check boxes as separate coloumn in grid. i am exporting the grid data to excel and am getting the value of
checkbox (true / false)also.how can i export data to excel excluding the checkbox values.
pls help me with this.
-
AuthorPosts