yui


YUI editor (RTE): How to wrap selection with a <span> and NOT lose formatting?

空扰寡人 提交于 2020-01-25 07:19:07
问题 Ok so I've got a problem I've been working on for the last week or so and have tried everything I know or could find. I am using YUI 2.x editor where users will be doing some heavy formatting. I have an external button on the page that needs to wrap the selected text in a <span> when the user clicks it, but it must do this without loosing any formatting. For some reason doing the following likes to erase all of the formatting in the selection: var sel = myEditor._getSelection(); var newEl = '

YUI Treeview (override labelClick)

£可爱£侵袭症+ 提交于 2020-01-25 05:05:22
问题 I am using dynamical loading in treeview, however I want it to load children nodes when click the plus icon instead of clicking label, I tried to override lableClick event and preventDefault event, but it didn't work, yui still load the children node when I clicked label tree.subscribe("labelClick", function(e) { YAHOO.util.Event.preventDefault(e); }); Any ideas to solve this problem? Thanks in advance. 回答1: The first parameter passed to your function is not the event, it's the node that was

How can I create a AlloyUI DiagramBuilder from the JSON returned by DiagramBuilder.toJSON()?

谁都会走 提交于 2020-01-16 04:12:08
问题 DiagramBuilder.toJSON() returns a JSON representation of the diagram. How can I use this JSON object to create a new DiagramBuilder with the same diagram? 回答1: You can pass the jsonData.nodes to the fields attribute of the DiagramBuilder : var diagramBuilderJSON = diagramBuilder.toJSON(); new A.DiagramBuilder({ fields : diagramBuilderJSON.nodes }).render(); 回答2: You can pass the result of DiagramBuilder.toJSON() to the fields parameter of the DiagramBuilder. See the example below. jsonData =

Y.Lang.isUndefined vs typeof undefined, which is better and why?

99封情书 提交于 2020-01-14 22:56:13
问题 I was wondering why YUI libs use Y.Lang.isUndefined() even when JS has a built in feature to check type of a variable. 回答1: The reason that method exists is for API consistency -- the YUI team felt it would be weird to leave it out. As LightStyle points out, isUndefined() doesn't do anything special, so you probably shouldn't use it unless you really like the aesthetics. In fact, only a few of the YUI type checking methods do any actual useful work beyond what you could do natively. Ryan

Y.Lang.isUndefined vs typeof undefined, which is better and why?

為{幸葍}努か 提交于 2020-01-14 22:55:11
问题 I was wondering why YUI libs use Y.Lang.isUndefined() even when JS has a built in feature to check type of a variable. 回答1: The reason that method exists is for API consistency -- the YUI team felt it would be weird to leave it out. As LightStyle points out, isUndefined() doesn't do anything special, so you probably shouldn't use it unless you really like the aesthetics. In fact, only a few of the YUI type checking methods do any actual useful work beyond what you could do natively. Ryan

YUI3 selector problem in ie8

别等时光非礼了梦想. 提交于 2020-01-13 17:59:29
问题 Y.one('form fieldset:nth-child(2)').toggleClass('hide'); in chrome, FF, opera this line works but in ie6-8 it throws an error 'Y.one(...)' is null or not an object. where is the problem? 回答1: Have to add the "selector-css3" module to your .use() statement if you want to use CSS3 selectors in browsers that don't support them natively. 来源: https://stackoverflow.com/questions/3713263/yui3-selector-problem-in-ie8

How to use YAHOO.util.Connect.asyncRequest and return results?

痞子三分冷 提交于 2020-01-13 11:08:39
问题 I'm using YAHOO.util.Connect.asyncRequest to get data from database, here is the code : function getCountArticle(contentCurValue) { var handleSuccess = function (res) { var countPubmed = YAHOO.lang.JSON.parse(res.responseText); var contentCountPubmed = countPubmed.totalArticleRecords; alert(contentCountPubmed); //return 15 for example }; var handleFailure = function () { alert("Error connecting data : Bad pubmed query"); }; var callback = { success:handleSuccess, failure:handleFailure,

How to use YAHOO.util.Connect.asyncRequest and return results?

匆匆过客 提交于 2020-01-13 11:08:09
问题 I'm using YAHOO.util.Connect.asyncRequest to get data from database, here is the code : function getCountArticle(contentCurValue) { var handleSuccess = function (res) { var countPubmed = YAHOO.lang.JSON.parse(res.responseText); var contentCountPubmed = countPubmed.totalArticleRecords; alert(contentCountPubmed); //return 15 for example }; var handleFailure = function () { alert("Error connecting data : Bad pubmed query"); }; var callback = { success:handleSuccess, failure:handleFailure,

YUI Autocomplete renders under other page elements in IE7

给你一囗甜甜゛ 提交于 2020-01-12 10:54:08
问题 I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example here. I have to admit, I don't fully understand how that CSS works, but it looks great. Inside the topmost box is a text-type input used for searching. That search box is wired up to a YUI autocomplete widget. Everything works fine in Firefox3 on Mac, FF2 on Windows, Safari on Mac. In IE7 on WinXP, the autocomplete suggestions render underneath the round-cornered boxes,

YUI Datatable - Get ID of DOM Element after page has loaded and use it in other YUI events

怎甘沉沦 提交于 2020-01-06 08:51:52
问题 Okay so I have a YUI Datatable. Most of it is exactly as the how to guide says to construct it. I have an event that governs changing the rows per page. It's linked to the rows per page drop down element and it saves the value of that drop down as a cookie when the drop down is changed. var onRPPChange1 = YAHOO.util.Event.addListener("yui-pg0-1-rpp24", "change", getRPP_1); The problem is that "yui-pg0-1-rpp24" (the ID of the drop down) changes whenever I make updates to my data table. I would

工具导航Map