jQWidgets Forums
Forum Replies Created
-
Author
-
Yeahh, though I provide the dataAdapter instance, It is not working.
Anyways Thanks a lot for the response.
Regards,
Aravind MSHi Peter,
The cellsrenderer function is valid. I am consoling the “row” from cellsrenderer, when the page loads for the first time, it consoles the row numbers such as 0,1,2,3,4…..199. At the same time when resize the columns, the cellsrenderer function is triggered again and in that case it consoles an object. Please have a look at the following code,
This example shows how to auto-resize the grid columns.
$(document).ready(function () {
var theme = getTheme();
var url = “../sampledata/orders.xml”;
// prepare the data
var source =
{
datatype: “xml”,
datafields: [
{ name: ‘ShippedDate’, map: ‘m\\:properties>d\\:ShippedDate’, type: ‘date’ },
{ name: ‘Freight’, map: ‘m\\:properties>d\\:Freight’, type: ‘float’ },
{ name: ‘ShipName’, map: ‘m\\:properties>d\\:ShipName’, type: ‘string’ },
{ name: ‘ShipAddress’, map: ‘m\\:properties>d\\:ShipAddress’, type: ‘string’ },
{ name: ‘ShipCity’, map: ‘m\\:properties>d\\:ShipCity’, type: ‘string’ },
{ name: ‘ShipCountry’, map: ‘m\\:properties>d\\:ShipCountry’, type: ‘string’ }
],
root: “entry”,
record: “content”,
id: ‘m\\:properties>d\\:OrderID’,
url: url
};var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
width: ‘100%’,
source: source,
theme: theme,
columns: [
{ text: ‘Ship Name’, datafield: ‘ShipName’, width: 50, cellsrenderer: function(row, column, value){
console.log(row);
console.log(typeof row); //first time the page loads it is number and once we click the button the type object. why does this changes the behaviour?
return row; //has valid return type
}
},
{ text: ‘Shipped Date’, datafield: ‘ShippedDate’, width: 30, cellsformat: ‘D’ },
{ text: ‘Freight’, datafield: ‘Freight’, width: 30, cellsformat: ‘F2’, cellsalign: ‘right’ },
{ text: ‘Ship Address’, datafield: ‘ShipAddress’, width: 50 },
{ text: ‘Ship City’, datafield: ‘ShipCity’, width: 100 },
{ text: ‘Ship Country’, datafield: ‘ShipCountry’}
]
});
$(“#button”).jqxButton({ theme: theme });
$(“#button”).click(function () {
$(“#jqxgrid”).jqxGrid(‘autoresizecolumns’);
return false;
});
});Ohh Yeahh, It doesn’t have a return type. But I’m simply keeping a return type like the below,
cellsrenderer: function(row, column, value){
console.log(row);
return row;
}When page load the console logs, 1,2,3,4,5,6,…….199
At the same time when I click the button the console logs,Object {
Freight: 68.66
ShipAddress: “Av. Copacabana, 267”
ShipCity: “Rio de Janeiro”
ShipCountry: “Brazil”
ShipName: “Ricardo Adocicados”
ShippedDate: Fri Mar 07 1997 05:30:00 GMT+0530 (India Standard Time)
uid: 199
}This changes the character of the row, so the action am doing
for example,
var sample = { 0: {}, 1: {}, 2{} }
cellsrenderer: function(row, column, value){
return sample[row][‘somedata’];
}This is throwing me an error, is there any way to handle this?
Regards,
Aravind1. jQWidgets v2.6.0
2.
In Chrome 21.0,
Uncaught TypeError: Cannot call method ‘toString’ of undefined jqxgrid.columnsresize.js:68In FF 15.0.1
TypeError: column.cellsrenderer(row, column, text) is undefined
text = column.cellsrenderer(row, column, text).toString();In Safari 5.1
Error3. jQuery v1.8.2
Regards,
Aravind MSThis is the error thrown from the js,
Uncaught TypeError: Cannot call method ‘toString’ of undefined jqxgrid.columnsresize.js:68
Regards,
Aravind MSDecember 10, 2012 at 1:48 pm in reply to: Search Toolbar Clarification Search Toolbar Clarification #12118Shaser, this is a remote search example. dataAdapter can able to format the data, but it doesn’t have in-build filter functionality. The properties where the ‘data’ holds are the query string of the ajax request url.
http://ws.geonames.org/searchJSON?callback=jQuery18204505064601544291_1355147014159&filterscount=0&groupscount=0&pagenum=0&pagesize=10&recordstartindex=0&recordendindex=18&featureClass=P&style=full&maxRows=20&name_startsWith=a
Here, geonames.org has the query string called ‘name_startsWith’, which filters out and sends the response.
You can simply use the filters,
var filter1 = filtergroup.createfilter(‘stringfilter’, filtervalue, filtercondition);
filtergroup.addfilter(filter_or_operator, filter1);
$(“#Grid”).jqxGrid(‘addfilter’, datafield, filtergroup, true);Regards,
Aravind.December 4, 2012 at 7:28 pm in reply to: Search Toolbar Clarification Search Toolbar Clarification #11897I figured it out, its really a silly question
Regards,
Aravind.December 4, 2012 at 4:27 pm in reply to: Sort order not working for ‘localdata’ Sort order not working for ‘localdata’ #11891Thanks a lot. I’ll update the jQwidgets version.
Regards,
AravindDecember 3, 2012 at 10:03 am in reply to: Disabled Checkbox in the Grid? Disabled Checkbox in the Grid? #11830Thank you.
Regards,
AravindDecember 3, 2012 at 9:43 am in reply to: Disabled Checkbox in the Grid? Disabled Checkbox in the Grid? #11828Yeah, but is there any option to give a disabled effect like the below one,
Regards,
AravindNovember 28, 2012 at 3:50 pm in reply to: Clarification in JSON Foramt Clarification in JSON Foramt #11621Yeah, fixed that in a different way.
Thanks a lot for the quick response.
November 28, 2012 at 3:15 pm in reply to: Clarification in JSON Foramt Clarification in JSON Foramt #11611I have got a small problem, if I have the following source format
var source =
{
datatype: “json”,
datafields: [
{ name: ‘CompanyName’ },
{ name: ‘ContactName’ },
{ name: ‘ContactTitle’, map: ‘ContactTitle>old’},
{ name: ‘ContactTitle’, map: ‘ContactTitle>new’},
{ name: ‘Address’ },
{ name: ‘City’ },
{ name: ‘Country’ }
],
localdata: data
}var cols = [
{text: ‘Company Name’, datafield: ‘CompanyName’},
{text: ‘Contact Name’, datafield: ‘ContactName’},
{text: ‘New Contact Name’, datafield: ‘ContactTitle’},
{text: ‘Old Contact Name’, datafield: ‘ContactTitle’},
{text: ‘Address’, datafield: ‘Address’},
{text: ‘City’, datafield: ‘City’},
{text: ‘Country’, datafield: ‘Country’},
]The ‘ContactTitle’ is overridden with new one. Is there way to display two columns with same datafield?
November 10, 2012 at 3:01 pm in reply to: Event or Method after Rows are populated Event or Method after Rows are populated #10828Thanks, Its working great…
November 8, 2012 at 8:06 am in reply to: Event or Method after Rows are populated Event or Method after Rows are populated #10661<div id="jqxWidget" style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid"></div>
<input type="button" id="generate" value="Generate" />
</div>November 8, 2012 at 8:05 am in reply to: Event or Method after Rows are populated Event or Method after Rows are populated #10660Sorry for the in inconvenience. I didn’t paste the HTML. In that example,
On page load, I am just building the grid. I have a button called “Generate” and when I click that, I am pushing the source, columns and on ready, I am trying to apply the filter where it is not working.
Regards,
Aravind -
AuthorPosts