Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
i can load XML data from Server, but can't put it into jqgrid
12/07/2008
23:33
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

my code:

 jQuery("#list2").jqGrid({       
       url: 'xObjectList_s.php',
    datatype: "xml",
       colNames:["OBJ_ID","OBJ_NAME", "HAS_VALUE", "OBJ_DESC"],

...........

and the xObjectList_s.php 's response like this :

<?xml version="1.0" standalone="yes"?>
<ObjectList>
  <Object>
    <OBJ_ID>4</OBJ_ID>
    <OBJ_NAME>INT</OBJ_NAME>
    <HAS_VALUE>false</HAS_VALUE>
    <OBJ_DESC>TelInfo</OBJ_DESC>
  </Object>
  <Object>
    <OBJ_ID>5</OBJ_ID>
    <OBJ_NAME>TE</OBJ_NAME>
    <HAS_VALUE>false</HAS_VALUE>
    <OBJ_DESC>TelDia</OBJ_DESC>
  </Object>
 </ObjectList> 

how can i put this response into jqgrid.
i can't construct the jqgrid from the response above,
dose response have the specified format ?
13/07/2008
04:00
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

Hi ,tony:

Do I have to conform the data from server side to the fixed format

<?xml version='1.0' encoding='utf-8'?>
<rows><page></page><total>2</total><records>13</records><userdata name='tamount'>3820.00</userdata>
<userdata name='ttax'>462.00</userdata><userdata name='ttotal'>4284.00</userdata><row id='13'><cell>13
</cell><cell>2007-10-06</cell><cell><![CDATA[Client 3]]></cell><cell>1000.00</cell><cell>0.00</cell>
<cell>1000.00</cell><cell><![CDATA[]]></cell></row><row id='12'><cell>12</cell><cell>2007-10-06</cell
><cell><![CDATA[Client 2]].............................

andxml data must have "<rows><page>......." ?

13/07/2008
05:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

You should configure xmlReader when the data is not in the format that is descibed into the docs.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

13/07/2008
06:08
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

tony said:

You should configure xmlReader when the data is not in the format that is descibed into the docs.

Regards

Tony


Hi,tony

Can xmlReader  work with xmlstring or data posted from  a url?

thx

13/07/2008
06:12
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

Hi ,tony:

 And i saved the data posted from a url to a xml file on local computer.

use the xmlReader ,the result is fine.

but work with a xmlstring as same as the data  ,it doesn't work.

regards

  murdoc

13/07/2008
06:26
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

jQuery("#list1").jqGrid({       
       datatype: 'xmlstring',
    datastr : str,
       colNames:["TaskId","START_TIME", "END_TIME", "ENABLE","DESC","STATUS"],
       colModel:[
           {name:"TASK_ID",index:"TASK_ID", width:50, xmlmap:"TASK_ID",editable:true,sorttype:"int"},
           {name:"TASK_START_TIME",index:"TASK_START_TIME", width:180,align:"left",editable:true,xmlmap:"TASK_START_TIME",sorttype:"date"},
           {name:"TASK_END_TIME",index:"TASK_END_TIME", width:180, align:"left",editable:true,xmlmap:"TASK_END_TIME", sorttype:"date"},
           {name:"TASK_ENABLE",index:"TASK_ENABLE", width:60,editable:true,xmlmap:"TASK_ENABLE",edittype:"select",editoptions:{value:"ENABLE:true;DISABLE:false"}},
           {name:"TASK_DESC",index:"TASK_DESC", width:140,editable:true,xmlmap:"TASK_DESC"},
           {name:"TASK_STATUS",index:"TASK_STATUS", width:40,editable:true,xmlmap:"TASK_STATUS"}
       ],
      height:250,
       rowNum:10,
    pager: jQuery('#pagered'),
       rowList:[10,20,30],
    editurl:"postTaskList.php" ,
       imgpath: gridimgpath,
    viewrecords: true,
    loadonce: true,
    xmlReader: {
            root : "TaskList",
            row: "Task",
            repeatitems: false,
            id: "TASK_ID",
            },
 caption: "TASK LIST",

--------------------------------------------------------------

<TaskList>
<Task>
<TASK_ID>1</TASK_ID>
 <TASK_START_TIME>2007-01-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-10-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>false</TASK_ENABLE>
<TASK_DESC>test</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>5</TASK_ID>
<TASK_ENABLE>false</TASK_ENABLE>
<TASK_DESC>每日统计</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>6</TASK_ID>
<TASK_START_TIME>2007-07-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-07-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>true</TASK_ENABLE>
<TASK_DESC>分时段统计全局及发话</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>7</TASK_ID>
<TASK_START_TIME>2007-07-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-09-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>true</TASK_ENABLE>
<TASK_DESC>A disabled valid task for test</TASK_DESC>
</Task>
<Task>
<TASK_ID>8</TASK_ID>
<TASK_ENABLE>false</TASK_ENABLE>
</Task>
<Task>
<TASK_ID>9</TASK_ID>
</Task>
<Task>
<TASK_ID>10</TASK_ID>
</Task>
<Task>
<TASK_ID>11</TASK_ID>
</Task>
<Task>
<TASK_ID>12</TASK_ID>
</Task>
<Task>
<TASK_ID>13</TASK_ID>
</Task>
</TaskList>

------------------------------

Why can't work? 
Thx a lot.

13/07/2008
09:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Try to eclose the string in single quotes, not in double something like

var mystr = '<TaskList>
<Task>
<TASK_ID>1</TASK_ID>
 <TASK_START_TIME>2007-01-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-10-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>false</TASK_ENABLE>
<TASK_DESC>test</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>

...

</TaskList>'

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/07/2008
02:06
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

Hi,tony:

Mystring is not a defined variable, but acquired by response data in xxxxx.php. So there is no double or single quotation mark.

I tried to use url:xxxxx.php, but it can not form grid neither. Is it a problem of character coding about response data in xxxxx.php?

I changed the characters in response data into utf-8 format, but it also doesn’t work.

   Thx a lot !

14/07/2008
10:57
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

I reccomend you to use FireBug and see the request from the server

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/07/2008
19:27
Avatar
murdoc
Member
Members
Forum Posts: 23
Member Since:
27/06/2008
sp_UserOfflineSmall Offline

Would you tell me what the request are used for ?

I have use FireBug,and when i get the url, the  response from the server like this :

 <TaskList>
<Task>
<TASK_ID>1</TASK_ID>
 <TASK_START_TIME>2007-01-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-10-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>false</TASK_ENABLE>
<TASK_DESC>test</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>5</TASK_ID>
<TASK_ENABLE>false</TASK_ENABLE>
<TASK_DESC>每日统计</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>6</TASK_ID>
<TASK_START_TIME>2007-07-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-07-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>true</TASK_ENABLE>
<TASK_DESC>分时段统计全局及发话</TASK_DESC>
<TASK_STATUS>1</TASK_STATUS>
</Task>
<Task>
<TASK_ID>7</TASK_ID>
<TASK_START_TIME>2007-07-01T00:00:00+08:00</TASK_START_TIME>
<TASK_END_TIME>2008-09-01T00:00:00+08:00</TASK_END_TIME>
<TASK_ENABLE>true</TASK_ENABLE>
<TASK_DESC>A disabled valid task for test</TASK_DESC>
</Task>
<Task>
<TASK_ID>8</TASK_ID>
<TASK_ENABLE>false</TASK_ENABLE>
</Task>
<Task>
<TASK_ID>9</TASK_ID>
</Task>
<Task>
<TASK_ID>10</TASK_ID>
</Task>
<Task>
<TASK_ID>11</TASK_ID>
</Task>
<Task>
<TASK_ID>12</TASK_ID>
</Task>
<Task>
<TASK_ID>13</TASK_ID>
</Task>
</TaskList>

In this data,there are  some Chinese characters in it.
I'm not sure the reason why i can't display  is because of the

Chinese characters.But why it can display when I use the
url:”xxx.xml”,after I saved  the
response as “xxx.xml” on my local computer.I'm sure

the xmlreader is right.

15/07/2008
02:51
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

If possible please send me a link to the problem. You can send me e-mail

to: tony at trirand dot com

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
25 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information