I am struggling to understand how I can achieve the look I want with HTML tables/CSS while also having an Accordion, I am getting data from multiple SharePoint lists and displaying it to the page in a JqueryUI Accordion however because it's essentially just a data dump I need to be able to add headers so the users know what data is what. I have created a JS Fiddle of how I tried to do it, with the issues explained below:
http://jsfiddle.net/7uv3m1fy/
The look I am trying to achieve is a set of headers across the top for the parent dataset, with the data from that set being the clickable part of the Accordion. These need the data to line up under the headers. This is pretty much the entire issue I have, they seem to be using only the first of the HTML table on subsequent rows when I want the information to fill all of the columns (preferably with a way to match where the information goes to under it's header)
I honestly don't know enough about CSS or how I could achieve this using DIV's while still being able to get information to line up.
The biggest issue I have is that because the data populating these tables is called from SharePoint lists/views, the number of columns is completely dynamic so I cannot hardcode column width/numbers.
Any suggestion of how I could do this using CSS or HTML or Both would be greatly appreciated.
below is the code I am currently using to generate this (C# as it's for a SharePoint WebPart)
try
{
if (parentItems.Count > 0)
{
newHTML = newHTML + "<Table style='table-layout:fixed' width='100%'><tr>";
foreach (string fieldName in viewFields)
{
newHTML = newHTML + "<td> " + parentList.Fields.GetFieldByInternalName(fieldName).Title + "</td>";
}
newHTML = newHTML + "</tr>";
}
}
catch
{
newHTML = newHTML + "No Results Found";
}
foreach (SPListItem parentitem in parentItems)
{
newHTML = newHTML + "<tr class='yes' width='100%'><td> Parent:</td><td>" + parentitem.ID.ToString() + "</td></tr><tr width='100%'><td>";
foreach (SPListItem childitem in childItems)
{
if (childitem[RelatedID].ToString() == parentitem.ID.ToString())
{
newHTML = newHTML + "<div>" + childitem.ID.ToString() + "</div>";
}
}
newHTML = newHTML + "</td></tr>";
}
newHTML = newHTML + "</table>";
}
And in the webpart I am adding the following to call it:
<div id="accordion">
<%= this.newHTML %>
</div>
I hope I have given enough information, although the code above doesn't really relate to the question it will show you how I am trying to dynamically output the HTML to achieve my goal.
Happy to provide more info if you need it.
Regards,
Related
A co-worker of mine shared an autohotkey script (it's actually an exe file that runs on the background). Anyways, when I click the hotkeys it opens up a company webiste and creates a shared query for whatever's on the clipboard. I was wondering how this is done and how I can make my own.
I'm specially curious about the "URL" modification that includes all these search options:
https://<COMPANYWEBSITE>/GotoDocumentSearch.do
That's the URL where I can search (sorry it's restricted and even if I link it you cant access it).
Anyways, after I set up all my options and stuff and click the search button I get the following URL:
https://<COMPANYWEBSITE>/DocumentSearch.do
I inspected the website source and this is the function that's called when I press the search button:
function preSubmitSearch(docPress) {
document.pressed = docPress;
// setup local doc types for submit by lopping over multi selects and building json data string
var localDocTypesJson = "{";
var sep = "";
jQuery(".localTypeSel").each(function (i) {
var selLocalTypes = jQuery(this).multiselect("getChecked");
// get doc type code from id ex. 'localTypeSel_PD'
//window.console.log("this.id=" + this.id);
var tmpArr = this.id.split("_");
var docTypeCode = tmpArr[1];
var selLocalTypesCnt = selLocalTypes.length;
if (selLocalTypesCnt > 0) {
var localTypes = "";
var sep2 = "";
for (var i2 = 0; i2 < selLocalTypesCnt; i2++) {
localTypes += sep2 + "\"" + selLocalTypes[i2].value + "\"";
sep2 = ",";
}
localDocTypesJson += sep + "\"" + docTypeCode + "\": [" + localTypes + "]";
sep = ",";
}
});
localDocTypesJson += "}";
jQuery("#localDocTypesJson").val(localDocTypesJson);
}
HOWEVER, the working code that was shared with me (that was written ages ago by some employee who's not here anymore). Has the following URL when I use the autohotkey:
https://<COMPANYWEBSITE>/DocumentSearch.do?searchType=all&localDocTypesJson=7D&formAction=search&formInitialized=true&searchResultsView=default&btn_search=Search&docName=*<CLIPBOARD>*&wildcards=on&docRevision=&latestRevOnly=true&docProjectNumber=&docEngChangeOrder=&docLocation=&findLimit=500&docTypes=Customer+Drawing&docTypes=Production+Drawing&docTypes=Manufacturing+Process+Document&docTypes=Specification+Or+Standard
Note: replaced text with "CLIPBOARD" for clarification.
I was wondering if that's a type of "URL-programming" or how can I make a direct URL that prompts for the search results from the website? is that Javascript? or how is that programmed? (I know Swift and some Java, but have never really used Javascript).
It doesn't seem like you are asking an AutoHotKey (AHK) question, but to give you an AHK example you can copy, here is how I would use AHK to use Google.com to search for whatever is in my clipboard:
wb := ComObjCreate("InternetExplorer.Application")
wb.Visible := true
wb.Navigate("https://www.google.com/search?q=" . StrReplace(Clipboard, " ", "+") . "", "")
Note, the URL format includes the query ("?q=whatever+you+had+in+Clipboard") in it with spaces replaced by "+"s.
Hth,
I am working on jpa query with specific only 3 columns, but it did not get the column name even I did name the query column,then this is what my Json response look like
[["123","name1","age15"],["124","name2","age12"],["125","name3","age14"]]
This is what i did
<table id="resultTable" border="1"></table>
.
.
success : function(data) {
var html = '';
var index = [];
for (var x in data) {
html += "<tr>";
html += "<td>" + data[index.push(x)] + "</td>"
+"<td>"+ data[index.push(x)] + "</td>"
+"<td>"+ data[index.push(x)] + "</td>"
html += "</tr>";
}
$('#resultTable').html(html);
And this is the result which i got
However, This is what i expect for
Again , the reason that I query for only 3 column is that i keep facing the
JsonMappingException:failed to lazily initialize a collectin of role:
,but what i am really want is only 3 columns, not the whole of the entity' column. Well my jpql query look like this
("SELECT s.Id,s.name,s.age FROM Student s").getResultList();
I'm struggling making the following razor snippet working
<ul>
#foreach (var lang in umbraco.cms.businesslogic.language.Language.GetAllAsList())
{
var url = Model.Content.Url + "?lang=" + #lang.CultureAlias;
if (currentCulture.TwoLetterISOLanguageName.Equals(lang.CultureAlias))
{
<li class="active">#lang.FriendlyName</li>
}
else
{
<li>#lang.FriendlyName</li>
}
}
If I remove the variable assignment between the foreach and the if it works fine, but otherwise I get a compilation error (like the razor parser understands a } as markup and tries to render it).
Any way to solve this?
Think the issue is in this line
var url = Model.Content.Url + "?lang=" + #lang.CultureAlias;
You don't need the additional # since you are already in 'code' mode
So try changing #lang.CultureAlias to lang.CultureAlias
You've got too many #s here:
var url = Model.Content.Url + "?lang=" + #lang.CultureAlias;
should become:
var url = Model.Content.Url + "?lang=" + lang.CultureAlias;
I'm working on a generic front end for SQL queries in my application, and would like to offer a preview feature that present query results.
Query results are returned in JSON format from a web service, and the JSON layout is of course completely different from query to query.
Result should be presented in a fully dynamic way, and look something like this:
Column 1 Column 2 Column 3
aaaaaaa bbbbbbbb ccccccc
.
.
.
Both column headers (from json key) and row content (from json value) should be generated in code, with or without the use of template libraries.
Any suggestions on what is the easiest and/or most efficient approach?
Something like this should do:
function createTableFromJson(json){
var table = "<table><tr>";
$.each(json.results[0], function(key, value){
table+= "<th>" + key + "</th>";
});
table += "</tr>";
$.each(json.results, function(key, value){
table +="<tr>";
$.each(value, function(k,v){
table += "<td>" + v + "</td>";
});
table +="</tr>";
});
table += "</table>";
return table;
}
Check out this jsfiddle for a complete example.
doesnt show the html format in outlook. please do reply me. sorry for the english
private void sendEmail() {
try {
String value = "<table>" +
"<tr>" +
"<td><b>Name </b></td>" +
"<td>android</td>" +
"</tr><br>" +
"<tr>" +
"<td><b>Version</b></td>" +
"<td>2.2</td>" +
"</tr>" +
"</table>";
Intent email_intent = new Intent(Intent.ACTION_SEND);
email_intent.setType("text/html");
email_intent.putExtra(Intent.EXTRA_SUBJECT, "android Details");
email_intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(value));
email_intent.setType("vnd.android.cursor.dir/email");
startActivity(Intent.createChooser(email_intent,"Sending mail.."));
}catch(Exception e) {
}
}
You have two setType() calls. Eliminate the second. Leave the email_intent.setType("text/html") there. See if that helps.
The <table>tag is apparently not supported by android jet See this link.
I'm also trying to show a table in an E-mail but I haven't succeeded jet.