jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Is there any type of grid that doesnt have the member url and can load json data
Tagged: grid
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 10 years, 6 months ago.
-
Author
-
December 1, 2014 at 9:42 am Is there any type of grid that doesnt have the member url and can load json data #63555
Hi,
I have a situation where I can’t use the member url to go and find the data instead I want to load the data in grid as soon as the function for loading the grid is invoked and I want to send the data along with the same function. If the url calls the data again I lose some data. So I don’t want to use url and send the data itself with the function.
public ActionResult Checker(int Id) { var dataContext = new PetaPoco.Database("MessageEntity"); var jsonOLD = dataContext.SingleOrDefault<OldData>("Select OldJson from MakerChecker2 where MakerCheckerId=@0", Id); var jsonNEW = dataContext.SingleOrDefault<NewData>("Select NewJson from MakerChecker2 where MakerCheckerId=@0", Id); MakerCheckerModel mcmodel = new MakerCheckerModel(); mcmodel.OldJson = jsonOLD.OldJson; mcmodel.NewJson = jsonNEW.NewJson; UserModel olduser = JsonConvert.DeserializeObject<UserModel>(mcmodel.OldJson); UserModel newuser = JsonConvert.DeserializeObject<UserModel>(mcmodel.NewJson); var propertyNameList = new List<string>(); List<PropertiesVM> model = new List<PropertiesVM>(); foreach (PropertyInfo propertyInfo in typeof(UserModel).GetProperties()) { PropertiesVM prop = new PropertiesVM(); prop.ColumnName = propertyInfo.Name; prop.OldValue = propertyInfo.GetValue(olduser, null); prop.NewValue = propertyInfo.GetValue(newuser, null); model.Add(prop); } var result = JsonConvert.SerializeObject(model); return View(result ); }
In this way I want to send the data along with the function and If this function is called from url:User/Checker/ I am not being able to send the Id along with. So I want to do this. Please help!
December 1, 2014 at 10:09 am Is there any type of grid that doesnt have the member url and can load json data #63557Hi learner,
You can take a look at: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/bindingtojsonstring.htm?arctic for loading JSON data without url.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comDecember 1, 2014 at 10:19 am Is there any type of grid that doesnt have the member url and can load json data #63560Thanks Peter for the fast response. The example you gave me uses
var data = ‘[{ “CompanyName”: “Alfreds Futterkiste”, “ContactName”: “Maria Anders”, “ContactTitle”: “Sales Representative”,…….}]’ as hard coding the data. But I cannot do this as my data is dynamically created by my function.December 1, 2014 at 10:30 am Is there any type of grid that doesnt have the member url and can load json data #63563Hi learner,
It does not matter that your data is dynamic. You can dynamically set the Grid’s source property, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comDecember 1, 2014 at 10:53 am Is there any type of grid that doesnt have the member url and can load json data #63567Thanks Peter, Ok then tell me how would I dynamically set the Grid’s source property, what I just tried was omitted the data and localdata property and inside source made the datafields according to my data. But couldn’t get the data loaded. Please help!!
December 1, 2014 at 12:37 pm Is there any type of grid that doesnt have the member url and can load json data #63577To refresh the Grid’s source dynamically do this: $(“#grid”).jqxGrid({source: newAdapter});
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.