I'm playing with Dart, and I'm trying to create a new TableElement with a header and one row in the tbody.
TableElement table = new TableElement();
Element head = table.createTHead();
TableRowElement headerRow = table.tHead.insertRow(-1);
headerRow.insertCell(0).text = "9";
headerRow.insertCell(1).text = "aaa";
headerRow.insertCell(2).text = "bbb";
headerRow.insertCell(3).text = "ccc";
var tBody = table.createTBody();
TableRowElement newLine = table.insertRow(-1); // add at the end
newLine.insertCell(0).text = "9";
newLine.insertCell(1).text = "aaa";
newLine.insertCell(2).text = "bbb";
newLine.insertCell(3).text = "ccc";
Unfortunately, both rows end up in the thead section.
On top of that, if I leave only
TableElement table = new TableElement();
var tBody = table.createTBody();
TableRowElement newLine = table.insertRow(-1); // add at the end
newLine.insertCell(0).text = "9";
newLine.insertCell(1).text = "aaa";
newLine.insertCell(2).text = "bbb";
newLine.insertCell(3).text = "ccc";
the row gets to tbody section, as expected.
Any Ideas?
Dart SDK 9474.
In your example, you are adding the first row directly into the table header that you have created. But the second row, you are trying to add directly into your table (not into your TBody)
Try the following:
TableElement table = new TableElement();
// ... See below ...
var tBody = table.createTBody();
TableElement newLine = tBody.insertRow(-1);
newLine.insertCell(0).text = "9";
newLine.insertCell(1).text = "aaa";
newLine.insertCell(2).text = "bbb";
newLine.insertCell(3).text = "ccc";
As mentioned in the comments, currently dart:html library does not support table header elements. As such a little bit of a work around needs to be done. The create table headers you can use the following:
Element head = table.createTHead();
TableRowElement headerRow = table.tHead.insertRow(-1);
var cell = new Element.tag('th');
cell.text = '9';
headerRow.insertAdjacentElement('beforeend', cell);
cell = new Element.tag('th');
cell.text = 'aaa';
headerRow.insertAdjacentElement('beforeend', cell);
cell = new Element.tag('th');
cell.text = 'bbb';
headerRow.insertAdjacentElement('beforeend', cell);
cell = new Element.tag('th');
cell.text = 'ccc';
headerRow.insertAdjacentElement('beforeend', cell);
// ... See above ...
Note however that the insertAdjacentElement does not work for firefox (as they chose not to implement that JavaScript method). And alternative is to use:
headerRow.nodes.add(cell);
Note that this is a work around and does not allow for indexing in the same way as insertCell and involves much more work to create the cells individually. This provides a work around util the two bugs listed in comments are resolved.
The below code worked fine with me:
TableElement table2 = new TableElement();
table2.style.width='100%';
var tBody2 = table2.createTBody();
table2.tHead.insertRow(-1)..insertCell(0).nodes.add(new Element.tag('th')..text = '1')
..insertCell(1).nodes.add(new Element.tag('th')..text = '2')
..insertCell(2).nodes.add( new Element.tag('th')..text = '3')
..insertCell(3).nodes.add( new Element.tag('th')..text = '4');
tBody2.insertRow(0)..insertCell(0).text = "9"
..insertCell(1).text = "aaa"
..insertCell(2).text = "bbb"
..insertCell(3).text = "ccc";
tBody2.insertRow(1)..insertCell(0).text = "9"
..insertCell(1).text = "aaa"
..insertCell(2).text = "bbb"
..insertCell(3).text = "ccc";
tBody2.insertRow(2)..insertCell(0).text = "9"
..insertCell(1).text = "aaa"
..insertCell(2).text = "bbb"
..insertCell(3).text = "ccc";
Related
this is the code which i custom the column in gridview to show the data. i try to get the data from editable text that i type from comboBox, but the data output become too slow to appear in list
settings.Columns.Add(column =>
{
column.FieldName = "Food";
column.Caption = "Food List";
column.Width = 350;
column.ColumnType = MVCxGridViewColumnType.ComboBox;
var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
comboBoxProperties.Width = new System.Web.UI.WebControls.Unit(350);
comboBoxProperties.DataSource = Food.Shared.ListFood;
comboBoxProperties.TextField = "Value";
comboBoxProperties.ValueField = "Key";
comboBoxProperties.ValueType = typeof(Guid);
comboBoxProperties.IncrementalFilteringMode = IncrementalFilteringMode.Contains;
comboBoxProperties.ItemStyle.Wrap = DefaultBoolean.True;
comboBoxProperties.ClientInstanceName = "foodListTo";
});
I have created a query in my module with this code:
var myName = "something"
var theQuery = _contentManager.Create("Query");
theQuery.As<TitlePart>().Title = myName + "Query";
var filterGroupRecord = new FilterGroupRecord();
var filterRecord = new FilterRecord()
{
Category = "Content", Type = "ContentTypes",
Description = myName , Position = 1,
State = "<Form><Description>" + myName
+ "</Description> <ContentTypes>" + myName + "</ContentTypes></Form>"
};
filterGroupRecord.Filters.Insert(0, filterRecord);
theQuery.As<QueryPart>().FilterGroups.Clear();
theQuery.As<QueryPart>().FilterGroups.Insert(0, filterGroupRecord);
And I know to create a projection widget I should use below code :
var theProjectionWidget = _contentManager.Create("ProjectionWidget");
theProjectionWidget .As<WidgetPart>().Title = myName + "ProjectionWidget";
theProjectionWidget .As<WidgetPart>().RenderTitle = false;
theProjectionWidget .As<WidgetPart>().Zone = "Content";
theProjectionWidget .As<WidgetPart>().Position = "1";
theProjectionWidget .As<WidgetPart>().LayerPart.Name = myName;
But I don't know how to assign the above query to this new projection widget.
How to assign query id to ProjectionPart.QueryLayoutRecordId???!!
I would appreciate any help.
These are links to this discussion in codeproject & codeplex:
http://www.codeproject.com/Questions/876128/How-to-create-a-projection-widget-programmatically
https://orchard.codeplex.com/discussions/580735
After some wrestling with code and debug I found solution for my question.
Anybody with my problem can use this code:
theProjectionWidget.As<ProjectionPart>().Record.QueryPartRecord = new QueryPartRecord(){
ContentItemRecord = theQuery.As<QueryPart>().ContentItem.Record,
FilterGroups = theQuery.As<QueryPart>().FilterGroups,
Id = theQuery.As<QueryPart>().Id,
Layouts = theQuery.As<QueryPart>().Layouts,
SortCriteria = theQuery.As<QueryPart>().SortCriteria
};
I am trying to delete a certain item from a database depending on conditions. Here is what I have:
while ($row = mysql_fetch_array($result)) {
$now = strtotime("now");
$dateArray = date_parse_from_format("n-j-Y", $row["date"]);
$event_date = strtotime($dateArray['year'].'-'.$dateArray['month'].'-'.$dateArray['day']);
// temp user array
$event = array();
if($event_date > $now) {
//Event is in the future
$pid_check =$row["pid"];
$event["pid"] = $row["pid"];
$event["name"] = $row["name"];
$event["longitude"] = $row["longitude"];
$event["latitude"] = $row["latitude"];
$event["pavement"] = $row["pavement"];
$event["traffic"] = $row["traffic"];
$event["environment"] = $row["environment"];
$event["image_b64"] = $row["image_b64"];
$event["date"] = $row["date"];
$event["time"] = $row["time"];
$event["type"] = $row["type"];
// push single product into final response array
array_push($response["events"], $event);
} else {
$result2 = mysql_query("DELETE FROM events WHERE pid = $pid_check");
}
}
But when I try this it comes up blank, when I comment out result2 it works but doesn't delete(duh). How can I get it to delete? Sorry if this is a simple question, my knowledge of the language is not much.
I think $pid_check is getting set only if the condition in your if is TRUE.
It's not getting set for the else branch.
One option is to relocate the assignment of $pid_check before the if test.
I want to add pagination in my site when user search for some item. I have tried the following code:
//Array Declaration//
$pages = array();
$userlist = array();
//paging variable//
$userlist_pg = $_GET['list_pg'];
if(empty($userlist_pg))
$userlist_pg = 1;
else
$userlist_pg=$_GET['list_pg'];
$userlist_limit = 10;//ADMIN_ITEMLIST_PER_PAGE;
$userlist_start = (($userlist_pg - 1) * $userlist_limit );
$userlist_currentpage = $userlist_pg;
$userlist_back = $userlist_pg-1;
$userlist_next = $userlist_pg + 1;
$query_string = "select cms_id,cms_variable,cms_page_name,cms_last_edited from tbl_cms";
//Paging variables start from here-------------------------
$orderlist = array();
$paging = new PagedResults();
$paging->TotalResults = table_query_count($query_string);
$InfoArray = $paging->InfoArray();
$query_string.=" LIMIT ".$InfoArray["MYSQL_LIMIT1"].", ".$InfoArray["MYSQL_LIMIT2"];
$PageVarName = 'client_page';
$smarty->assign("page_display", getpagelist($InfoArray["CURRENT_PAGE"],$InfoArray["PREV_PAGE"],$InfoArray["NEXT_PAGE"],$InfoArray["TOTAL_PAGES"],$InfoArray["Second_next"],$InfoArray["third_next"],$InfoArray["fourth_next"],$PageVarName));
$smarty->assign("currentpage",$InfoArray["CURRENT_PAGE"]);
$smarty->assign("total_pages",$InfoArray["TOTAL_PAGES"]);
//Paging variables end here-------------------------
it gives the following errors.
Call to undefined function table_query_count() in /home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php on line 110
Class 'PagedResults' not found in /home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php on line 30
Call to undefined method PagedResults::InfoArray() in /home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php on line 111
Looks like you forgot to include the file(s) with definition of function table_query_count and class PagedResults
Does anyone know how to get all the items that are flagged inside the Inbox using Microsoft Exchange Web-Services?
Apparently they are neither inside Tasks folder (even though they appear there in Outlook), nor do they have IsReminderSet set to true.
Following attempts either return only appointments or true tasks only, but not flagged messages:
var msgsView = new ItemView(100);
var msgsFilter = new SearchFilter.IsEqualTo(ItemSchema.IsReminderSet, true);
var flagged = exSvc.FindItems(WellKnownFolderName.Inbox, msgsFilter, msgsView);
or
var taskView = new ItemView(100);
var tasks = exSvc.FindItems(WellKnownFolderName.Tasks, taskView);
neither work.
I know this question is old, but I just found list sample code which looks like it might do the trick (I haven't tested it myself yet)
source: http://independentsoft.de/exchangewebservices/tutorial/findmessageswithflag.html
IsEqualTo restriction1 = new IsEqualTo(MessagePropertyPath.FlagStatus, "1"); //FlagStatus.Complete
IsEqualTo restriction2 = new IsEqualTo(MessagePropertyPath.FlagStatus, "2"); //FlagStatus.Marked
Or restriction3 = new Or(restriction1, restriction2);
FindItemResponse response = service.FindItem(StandardFolder.Inbox
, MessagePropertyPath.AllPropertyPaths, restriction3);
for (int i = 0; i < response.Items.Count; i++)
{
if (response.Items[i] is Message)
{
Message message = (Message)response.Items[i];
Console.WriteLine("Subject = " + message.Subject);
Console.WriteLine("FlagStatus = " + message.FlagStatus);
Console.WriteLine("FlagIcon = " + message.FlagIcon);
Console.WriteLine("FlagCompleteTime = " + message.FlagCompleteTime);
Console.WriteLine("FlagRequest = " + message.FlagRequest);
Console.WriteLine("-----------------------------------------------");
}
}