jQWidgets Forums
Forum Replies Created
-
Author
-
February 4, 2014 at 5:52 pm in reply to: DataTable – Problem with reading XML data DataTable – Problem with reading XML data #48948
Actually, the above script I copied and pasted it from the browser debug window, which could be confusing. In my code, it is actually much simpler. I am using VS MVC, so my code is written as follow:
// In the Controller
ViewBag.XmlData = “<TableName><Record id=\”1\” firstname=\”Joe1\” lastname=\”Smith\” telephone=\”1234567890\” /><Record id=\”2\” firstname=\”Joe2\” lastname=\”Smith\” telephone=\”1234567890\” /><Record id=\”3\” firstname=\”Joe3\” lastname=\”Smith\” telephone=\”1234567890\” /><Record id=\”4\” firstname=\”Joe4\” lastname=\”Smith\” telephone=\”1234567890\” /><Record id=\”5\” firstname=\”Joe5\” lastname=\”Smith\” telephone=\”1234567890\” /></TableName>”;
return View();// And in the index.cshtm file, I simple set the ViewBag.XmlData to the localdata: as shown below
// prepare the data
var source =
{
datatype: “xml”,
datafields: [………..],
root: “TableName”,
record: “Record”,
id:”\\id”,
localdata: @ViewBag.XmlDataBlablabla….
I tried to wrap @ViewBag.XmlData with double quotes, single quotes, but still get the error.
Thanks.
February 4, 2014 at 5:41 pm in reply to: DataTable – Problem with reading XML data DataTable – Problem with reading XML data #48946BTW, the problem is that somehow it does not understand the HTML code for the HTML reserved character and error out at the first “less than” <
SCRIPT1002: Syntax error
localdata: <TableName><Record id="1" firstname="Joe1" lastname="Smith" telephone="1234567890" /><Record id="2" firstname="Joe2" lastname="Smith" telephone="1234567890" /><Record id="3" firstname="Joe3" lastname="Smith" telephone="1234567890" /><Record id="4" firstname="Joe4" lastname="Smith" telephone="1234567890" /><Record id="5" firstname="Joe5" lastname="Smith" telephone="1234567890" /></TableName>
Thanks
February 4, 2014 at 5:23 pm in reply to: DataTable – Problem with reading XML data DataTable – Problem with reading XML data #48945Hi Peter,
Do you have an example code of passing a XML string to the localdata: instead of using the url? All my stored procedure return a XML string (as shown below), and I simply want to set the XML string to localdata:
<TableName>
<Record id=”1″ firstname=”Joe1″ lastname=”Smith” telephone=”1234567890″ />
<Record id=”2″ firstname=”Joe2″ lastname=”Smith” telephone=”1234567890″ />
<Record id=”3″ firstname=”Joe3″ lastname=”Smith” telephone=”1234567890″ />
<Record id=”4″ firstname=”Joe4″ lastname=”Smith” telephone=”1234567890″ />
<Record id=”5″ firstname=”Joe5″ lastname=”Smith” telephone=”1234567890″ />
</TableName>Thanks.
February 4, 2014 at 5:16 pm in reply to: Binding DataTable to XML Attribute Binding DataTable to XML Attribute #48944Thanks Peter, that works like magic.
Never mind. It’s my bad. Width: ‘100%’ works. I forgot to put the value between the quotes.
Thanks.
I set the width: 100% before (and just tried it again), and the data table failed to display due to an error. Can you give me the link to the demo that used 100%?
Thanks.
// This works
$(“#dataTable”).jqxDataTable(
{
width: 1140,
source: dataAdapter,
…..// This failed
$(“#dataTable”).jqxDataTable(
{
width: 100%,
source: dataAdapter,Thanks Peter. It works. Simple but never thought about.
How about the jqxDataTable itself. If I leave the width undefined, it does not fill the width of its parent.
-
AuthorPosts