public void DoFilter(jQueryObject obj, bool postBack) { jQueryUIObject selects = (jQueryUIObject)obj.Find("th select"); string filterValue = ""; selects.Each((ElementIterationCallback) delegate(int index, Element el) { jQueryUIObject select = (jQueryUIObject)jQuery.FromElement(el); Array checkedItems = select.MultiSelect("getChecked"); if (checkedItems.Length > 0) { if (filterValue.Length > 0) { filterValue = filterValue + ",,"; } filterValue = filterValue + select.GetAttribute("name") + "="; for (int i = 0; i < checkedItems.Length; ++i) { if (i > 0) { filterValue = filterValue + "||"; } filterValue = filterValue + ((InputElement)checkedItems[i]).Value; } } }); if (this.Filter != filterValue) { this.Filter = filterValue; if (postBack) { PostBack(0); } } }
private void SendMessage(jQueryEvent e) { jQueryObject button = jQuery.FromElement(e.CurrentTarget); jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#playerDetailsCard"); string text = jQuery.Select("#playerDetailsCard .comments").GetValue(); string id = dialog.GetAttribute("data-id"); Script.Literal("debugger"); dialog.Attribute("disabled", "disabled").AddClass("ui-state-disabled"); JsonObject parameters = new JsonObject("userId", id, "comments", text); jQuery.Post("/services/SendMessage?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback <object>) delegate(object data, string textStatus, jQueryXmlHttpRequest <object> request) { dialog.Attribute("disabled", "").RemoveClass("ui-state-disabled"); dialog.Dialog("close"); Utility.ProcessResponse((Dictionary)data); } ); }
/// <summary> /// Static method that gets called when a user is selected from the grid (the wiring is hard-coded in PlayerGrid itself for now) /// </summary> /// <param name="e"></param> public static void SelectUser(jQueryEvent e) { // Get the button that was selected - id should be the FacebookId of the selected user jQueryObject button = jQuery.FromElement(e.CurrentTarget); string selectedUserId = button.GetAttribute("data-fbId"); // Get the offer id from the dialg attribute jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#playerGridCard"); string offerId = dialog.GetAttribute("data-offerId"); // Script.Alert("offerId: " + offerId + " uid: " + selectedUserId); // Post the confirmation - now that we have the offer id and the selected user JsonObject parameters = new JsonObject("offerId", offerId, "uid", selectedUserId); dialog.Attribute("disabled", "disabled").AddClass("ui-state-disabled"); jQuery.Post("/services/ConfirmOfferFromPage?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback <object>) delegate(object data, string textStatus, jQueryXmlHttpRequest <object> request) { dialog.Dialog("close"); Utility.ProcessResponse((Dictionary)data); } ); }