PDA

View Full Version : [CLOSED] MultiSelect with Checkbox Items



michaeld
Aug 03, 2013, 12:05 PM
I am finding I need to have a checkbox in my multiselect control. Ideally it would be nice if multiselect supported SelectionMode="Checkbox" or SelectionMode="All" like MultiCombo.

It's hard to tell when items are selected (when all items are initially set to selected or unselected) if clicking an item is selecting or deselecting, especially if there is only 1 item in the list. It becomes a guessing game of whether dark means selected or light does.

Any thoughts how to add a checkbox? Ideally I wish to be able to bind listitems, not a checkbox group. Not only that but checkboxes don't highlight select.

michaeld
Aug 04, 2013, 12:33 AM
Would it be anywhere close to as easy to add as this?
http://stackoverflow.com/questions/6600919/extjs-4-combobox-with-checkboxes

Daniil
Aug 05, 2013, 6:46 AM
Hi @michaeld,

I can suggest the following.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<style>
.my-multiselect .x-boundlist-item {
background-image: url("/extnet/resources/images/grid/unchecked-gif/ext.axd");
background-repeat: no-repeat;
background-position: 1px 1px;
padding-left: 18px;
}

.my-multiselect .x-boundlist-selected {
background-image: url("/extnet/resources/images/grid/checked-gif/ext.axd");
}
</style>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:MultiSelect runat="server" Cls="my-multiselect">
<Items>
<ext:ListItem Text="Item 1" />
<ext:ListItem Text="Item 2" />
<ext:ListItem Text="Item 3" />
</Items>
</ext:MultiSelect>
</form>
</body>
</html>

michaeld
Aug 08, 2013, 2:47 AM
Thank you. As this was such an easy feature to add, may I ask this item escalate it to becoming a feature request to add SelectionMode parameter? It seems totally appropriate here to match it to multiselectcombo. Do you mind adding this to the list or passing it on to extjs to do so (if you think it's more suitable in their feature-set)?

Daniil
Aug 09, 2013, 6:46 AM
Thank you for the feature request. We added the ShowCheckbox property.

Example

<ext:MultiSelect runat="server" ShowCheckbox="true">
<Items>
<ext:ListItem Text="Item 1" />
<ext:ListItem Text="Item 2" />
<ext:ListItem Text="Item 3" />
</Items>
</ext:MultiSelect>

michaeld
Aug 09, 2013, 9:28 AM
Thank you. Awesome! I'll keep an eye on the trunk. I hasn't been checked in yet.

michaeld
Aug 13, 2013, 1:53 AM
Checking in just in case this was forgotten.

Daniil
Aug 13, 2013, 5:57 AM
Weird. I committed it before posting my previous message. I see the changes in my local repository and it says that it is committed, but indeed, I cannot see the changes in the SVN repository. Something wrong happened with my SVN client.

I re-committed, revision #5331. Please check it out and thank you for the notification.

michaeld
Aug 17, 2013, 1:41 AM
Thank you. I wasn't sure if it was an error on my side.

Also, I thought I should note that I reviewed your changes and I believe you may have overwritten vlads minify implementation code in MultiSelect.cs from 5321. You may wish to revert that file and verify the resources too.

Daniil
Aug 19, 2013, 10:20 AM
Sorry, I am not getting you. I cannot see what I have overwritten. Please elaborate.

michaeld
Aug 28, 2013, 12:07 PM
Sorry, I am not getting you. I cannot see what I have overwritten. Please elaborate.


This is what I observe when I run diff against 5321 on mutliselect.cs


Index: MultiSelect.cs
================================================== =================
--- MultiSelect.cs (revision 5320)
+++ MultiSelect.cs (revision 5321)
@@ -42,7 +42,7 @@
List<ResourceItem> baseList = base.Resources;
baseList.Capacity += 1;

- baseList.Add(new ClientScriptItem(typeof(MultiSelect), "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect.j s", "/ux/multiselect/multiselect.js"));
+ baseList.Add(new ClientScriptItem(typeof(MultiSelect), "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect.j s", "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect-debug.js", "/ux/multiselect/multiselect.js", "/ux/multiselect/multiselect-debug.js"));

return baseList;
}


Note reference to debug versus standard js inclusion files. I'm assuming this is his implementation from a transform reference name instead of the direct file. I haven't verified so please bare with me, but it was clear to me there was a difference that was lost in your update given the time frames of updates and check-in around that time. If you can't verify, I'll eventually do so. Just can't till next week.

Daniil
Aug 28, 2013, 3:18 PM
Seems I didn't erase those changes in my 5331 commit.

#5321

protected override List<ResourceItem> Resources
{
get
{
List<ResourceItem> baseList = base.Resources;
baseList.Capacity += 1;

baseList.Add(new ClientScriptItem(typeof(MultiSelect), "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect.j s", "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect-debug.js", "/ux/multiselect/multiselect.js", "/ux/multiselect/multiselect-debug.js"));

return baseList;
}
}

#5331

protected override List<ResourceItem> Resources
{
get
{
List<ResourceItem> baseList = base.Resources;
baseList.Capacity += 2;

baseList.Add(new ClientStyleItem(typeof(MultiSelect), "Ext.Net.Build.Ext.Net.ux.resources.multiselect-embedded.css", "/ux/resources/multiselect.css"));
baseList.Add(new ClientScriptItem(typeof(MultiSelect), "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect.j s", "Ext.Net.Build.Ext.Net.ux.multiselect.multiselect-debug.js", "/ux/multiselect/multiselect.js", "/ux/multiselect/multiselect-debug.js"));

return baseList;
}
}

Sorry if I still misunderstand something.

michaeld
Aug 28, 2013, 11:25 PM
My bad. The unified difference was showing a minus (-) which mislead me on what was actually there. Thank you again. This add made a big difference for me.

michaeld
Oct 13, 2013, 12:46 PM
This was broken in latest trunk. I'm assuming broken in 2.3.

Web Resource not found.

Daniil
Oct 14, 2013, 7:26 AM
Thank you for the report! Corrected in the trunk.

Unfortunately, yes, it is broken in the v2.3 release. I am afraid it has to wait the next release.

Though, if we catch another more important problem with the v2.3 release, there is a good possibility of a short next release v2.3.1. In this case, the MultiSelect's ShowCheckbox will be included as well.

michaeld
Oct 14, 2013, 1:02 PM
These things happen. Not worried, just reporting, and thank you for the quick response on this.

This one isn't a show-stopper. The redirect issue in my other thread, however, is.

michaeld
Oct 15, 2013, 8:29 AM
Okay. I tested with the latest SVN. I'm still having a webresource failing with a 404 and the checkboxes are not showing still.

Daniil
Oct 15, 2013, 8:55 AM
Please try to clear a browser's cache. Does it help?

michaeld
Oct 15, 2013, 9:08 AM
Not the issue. Not saying I'm not capable of making a beginner mistake like that, but I'm not sure why
this resource: /ux/resources/images/multiselect/checked-gif/ext.axd is returning a 302 redirect. Then I get the 404 on /WebResource.axd?d=x9YzAnzPjqkTd-DBbiy6OftPaz_TPtxKmcE_eQdfKnFKeipyzxkALCzsIlPB8aAT 0vbQA3mBryihMaXfnpupGE5m4GEdCUGvFknkqUI7RoQ8spJ5mo 4dIpU-cnFV3YVUytyWIcAW1sMcJrDMrICitsMw30Y1&t=635173924616440000

I've never seen this before.

When I type the first resource directly into the address bar, I get the redirect.

michaeld
Oct 15, 2013, 9:38 AM
Okay, I'm stepping through the code of ResourceHandler.cs

The issue is this.GetType().Assembly.GetManifestResourceStream( this.webResource) is returning null for Ext.Net.Build.Ext.Net.ux.resources.images.multisel ect.checked.gif

Then when it attempts to write image, it calls this.context.Response.Redirect(Page.ClientScript.G etWebResourceUrl(this.sm.GetType(), this.webResource)); which is that obfuscated url which returns nothing.


It seems to me there are 2 problems. 1. the image isn't being added to the compiled resource, and 2. the GetWebResourceUrl is dunno.

Daniil
Oct 15, 2013, 10:03 AM
This returns a stream for me:

this.GetType().Assembly.GetManifestResourceStream( this.webResource);
for the same webResource.

The images are included to the assembly, they both are marked as Embedded Resource.

It works for me.

Is there a possibility to reproduce it online?

michaeld
Oct 15, 2013, 11:56 AM
Okay, so verified, resource/images multiselect is not part of the project file.

I added the existing items to the project in Ext.Net\Build\Ext.Net\ux\resources\images\multisel ect and set them to embedded resources and problem was resolved. I'd post the the update but you have no policy for user contribution so you'll have to do it on your side.

michaeld
Oct 15, 2013, 12:06 PM
Sometimes I'm not sure the Turtle merge always works. I verified with compare and the project did not contain the files.

Daniil
Oct 15, 2013, 12:09 PM
I would insist the Ext.NET project does contain those images:)

Here is Ext.NET.csproj.
http://svn.ext.net/premium/trunk/Ext.Net/Ext.Net.csproj


<EmbeddedResource Include="Build\Ext.Net\ux\resources\images\multiselect\chec ked.gif" />
<EmbeddedResource Include="Build\Ext.Net\ux\resources\images\multiselect\unch ecked.gif" />

I suspect your Ext.Net.csproj is somehow out-of-sync.

michaeld
Oct 15, 2013, 1:27 PM
Wouldn't be the first time. I'll try a fresh restart in the morn and let you know. I'm at the last of my ext.net issues. On last restart and test and we're go.

michaeld
Oct 16, 2013, 2:16 AM
I deleted everything and did a fresh checkout of Ext.net. Seemed to address the issue. Strange.