WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.113' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1714716797.8676979541778564453125', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":1392,"date":"2013-04-18T10:57:28","date_gmt":"2013-04-18T08:57:28","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=1392"},"modified":"2013-04-18T11:16:37","modified_gmt":"2013-04-18T09:16:37","slug":"wp-toolkit-adding-a-item-in-the-selecteditems-collection-of-a-longlistmultiselector-actually-adds-2","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2013\/04\/18\/wp-toolkit-adding-a-item-in-the-selecteditems-collection-of-a-longlistmultiselector-actually-adds-2\/","title":{"rendered":"WP Toolkit : Adding a item in the SelectedItems collection of a LongListMultiSelector actually adds 2…"},"content":{"rendered":"

A quick blog post about a bug I encountered today with the LongListMultiSelector : adding 2 items in its SelectedItem property actually adds 2 items (twice the same) in the SelectedItem collection.<\/strong> <\/p>\n

This is quite boring because it also raises the SelectionChanged event twice and can mess up your business logic.<\/p>\n

Let’s see how to fix this temporary (I hope!) issue :
\n
\nThe problem is that the LongListMultiSelector listen to the changes(add\/remove\/replace\/clear) in it’s SelectedItem collection so we can’t use it directly. <\/p>\n

The solution is to ‘fake’ an user selection using the LongListMultiSelectorItem<\/strong> which is the container of each item.<\/p>\n

So instead of writing this code :
\n[csharp]
\nforeach (var item in LongListMultiSelector.ItemsSource)
\n{
\n \/\/LongListMultiSelector.SelectedItems.Add(item);
\n}
\n[\/csharp]<\/p>\n

you have to write this code :
\n[csharp]
\nforeach (var item in LongListMultiSelector.ItemsSource)
\n{
\n var container = LongListMultiSelector.ContainerFromItem(item)
\n as LongListMultiSelectorItem;
\n if (container != null) container.IsSelected = true;
\n}
\n[\/csharp]<\/p>\n","protected":false},"excerpt":{"rendered":"

A quick blog post about a bug I encountered today with the LongListMultiSelector : adding 2 items in its SelectedItem property actually adds 2 items (twice the same) in the SelectedItem collection. This is quite…<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[14,15,44,45,31],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1392"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=1392"}],"version-history":[{"count":7,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1392\/revisions"}],"predecessor-version":[{"id":1399,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1392\/revisions\/1399"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=1392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=1392"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=1392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}