Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add extra option?
Message
De
17/09/2014 08:12:14
 
 
À
17/09/2014 08:07:37
Information générale
Forum:
Javascript
Catégorie:
Autre
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01607633
Message ID:
01607688
Vues:
37
>>>Add it on the server?:
var xxx = _itemTreeAdapter.GetAll().Select(it=> new {id = it.NodeId, Descrip = it.Descrip}).OrderBy(it=>it.Descrip);
>>>var itemTrees = xxx.ToList();
>>>itemTrees.Insert(0, new { id = 0, Descrip = "Select Item Tree... " });
or in JavaScript:
metaDate.itemTrees.unshift({ id: 0, Descrip: 'Select Item Tree...' });
>>
>>Hi Viv,
>>
>>Thanks a lot, I'll try that. For some reason similar, but more complex code (as I read that unshift doesn't work in IE8) didn't work in JavaScript. The item was added OK, but it was not shown and I can not figure why.
>
>I think I read somewhere that unshift works in IE8 but that didn't return the new length as per specs. Wouldn't matter in this case.
>
>But if you always want to add the extra item (and are using the dropdown on other pages) then I'd lean towards doing it on the server anyway ......

What is strange and I don't understand, as why this item added in JavaScript or in the cshtml with
<option value="0">Select ...</option>
doesn't show up at all in the list. However, if I use option value="" then it shows up but causing this weird error. Do you see why there is such a problem?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform