jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Datasource url for jqxgrid
This topic contains 4 replies, has 2 voices, and was last updated by harsh 9 years, 10 months ago.
-
Author
-
I have a jqxgrid in view as follows
var source = { datatype: "json", datafields: [ { name: 'MailBoxID', type: 'string' }, { name: 'TOName', type: 'string' }, { name: 'Subject', type: 'string' }, { name: 'DateCreated', type: 'date' } ], url: "/Mailman/Results/" }; var dataAdapter = new $.jqx.dataAdapter(source); var imagerenderer = function (row, datafield, value) { return '<img style="margin-left: 5px;" src="/Images/props.gif' + value + '"/>'; } // initialize jqxGrid $("#jqxgrid").jqxGrid( { width: 700, height:310, source: dataAdapter, pageable: true, columns: [ { text: '', datafield: 'Image', cellsrenderer: imagerenderer }, { text: "To", datafield: "TOName", width: 289 }, { text: "Subject", datafield: "Subject", width: 281 }, { text: "Date", datafield: "DateCreated", cellsformat: 'M/d/yyyy', width: 100 } ] }); }); }); and controller methods as follows
public ActionResult Result()
{
Result res = new Result();
List<Result> list = new List<Result>();
list = res.GetResults();
return View(list);
}I would like to know how to give the url for jqxgrid when the data source url is something like ” localhost:49295/Mailman/Result?status=W” instead of ” localhost:49295/Mailman/Result”. Here status can be N,W,R etc depending on the web browser url.
Hello harshini,
You can pass the additional parameters in the source data property, e.g.:
var source = { datatype: "json", datafields: [{ name: 'MailBoxID', type: 'string' }, { name: 'TOName', type: 'string' }, { name: 'Subject', type: 'string' }, { name: 'DateCreated', type: 'date' }], url: "/Mailman/Results/", data: { status: 'W' } };
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you
Hi ,
I have a particular scenario where the url can be
1.http://localhost:49295/Mailman/Result?status=W
2.http://localhost:49295/Mailman/Result?EMAILFROM=&EMAILTO=t16&keywords=&MAILNAMEJOIN=ORso I have given the source as follows. It works when status = W but does not for the second url. Can you please let me know if the data is correct when it has multiple parameters?
var source = “”;
var status = “@Request.QueryString[“status”]”;(this will be null for second url but it goes into the if block for some reason)if (status != null) {
source =
{
datatype: “json”,
datafields: [
{ name: ‘MailBoxID’, type: ‘string’ },
{ name: ‘TOName’, type: ‘string’ },
{ name: ‘Subject’, type: ‘string’ },
{ name: ‘DateCreated’, type: ‘date’ }],
url: “/Mailman/Results/”,
data: {
status: status}
};
}
else
{
source =
{
datatype: “json”,
datafields: [
{ name: ‘MailBoxID’, type: ‘string’ },
{ name: ‘TOName’, type: ‘string’ },
{ name: ‘Subject’, type: ‘string’ },
{ name: ‘DateCreated’, type: ‘date’ }],
url: “/Mailman/Results/”,
data: {EMAILFROM: emailfrom,
EMAILTO: emailto,
keywords: kwywrds,
MAILNAMEJOIN: mailnamejoin}
};
}Hi,
I got it working.
condition to check null was incorrect.
Thanks.
-
AuthorPosts
You must be logged in to reply to this topic.