Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Zoho Docs
Google Docs
Each Attachment size should not exceed 1MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
imgonna
imgonna's Profile
2
Posts
8
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
AppendTo and "refresh" advice
[2Replies]
22-Dec-2012 05:24 PM
Forum:
jQuery Mobile
Hi
I am reading a csv file with php / ajax and creating a list from the file. That works fine.
I am then using: AppendTo to push the html I've built into the <content>
At this point it breaks, as I now know due to the order in which JQM builds the page
Is there some form of "refresh" I need to do to make JQM "see" the html and respond accordingly?
In action >>>>
http://glengilchrist.co.uk/csv/table2.html
Initally I thought I needed a $('#buglist').listview('refresh'); << but
a) I am not sure where to put it
b) There is also a collapsed list being built dynamically.
My code is:
<!DOCTYPE html>
<html>
<head>
<title>Bacterium Antibiograms reading csv</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Bacterium Antiobiograms</h1>
</div>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'get-csv.php',
data: null,
success: function(text) {
var fields = text.split(/\n/);
fields.pop(fields.length-1);
var headers = fields[0].split(','), markup = '';
var data = fields.slice(1, fields.length);
for(var j = 0; j < data.length-2; j += 1) {
var dataFields = data[j].split(',');
markup +='<div data-role="collapsible" data-theme="b" data-content-theme="c">';
markup +='<h2>' + dataFields[1] + '</h2>';
markup +='<id = "buglist" ul data-role="listview">';
markup +='<li>' + headers[2] +"........" + dataFields[2] + '</li>';
markup +='<li>' + headers[3] +"........" + dataFields[3] + '</li>';
markup +='<li>' + headers[4] +"........" + dataFields[4] + '</li>';
markup +='<li>' + headers[5] +"........" + dataFields[5] + '</li>';
markup +='</ul>';
markup +='</div>';
}
$('.bugs').append(markup);
}
});
});
</script>
<div data-role="content" class="bugs">
</div>
<div data-role="footer">
version 0.5
</div>
</div>
</body>
</html>
This must be easier than I am making it......
Any advice on refreshing the <content> greatly received.
I have read the documentation on dynamic pages and I cant adapt the example to my case -- must be getting old.
Cheers
Glen
Noob question - read from csv into nested list (I think)
[11Replies]
21-Dec-2012 07:43 PM
Forum:
Getting Started
Hi all
I am trying to build a simple app to load csv data from my server into what I think is called a nested list.
I initially want to display data from only one field, which will slide across into the full record when selected.
I can read the csv with some php and ajax to output a table:
http://www.glengilchrist.co.uk/csv/table.html
What I am looking to do is to convert this into something That looks:
Screen 1
Staphylococcus aureus (MSSA)
Staphylococcus aureus (MRSA)
Streptoccous pneuoniaeA
When the names are selected, detail is displayed on a "new view"
Staphylococcus aureus (MSSA) (as the title)
Penicillin
5
Ampicillin
Methicillin
100
Norfloacin 79
Fusidic Acid 99
With the relevant back slider.
I just can not for the life of me work out out to:
A) Get my data from the
dataFields[0]
dataFields[1] etc into a list
B)Make what I think is called a nested list, so that when selected the detail is shown.
Am I making a real hash of this, as I suspect I am -- it seemed like such an easy ask, as the php / html route was quite simple.
Help ;-)
Cheers
Glen
«Prev
Next »
Moderate user : imgonna
Forum