//---------------------------------------------------------------------------------------------------- public void Bind_ModelListElements(IMRBPattern <M, VM> mrb, string modelKey) { var jListElements = mrb.jF2("[ModelList]"); if (jListElements == null) { return; } for (int i = 0; i < jListElements.length; i++) { var jListItem = J(jListElements[i]); if (modelKey == "*" || modelKey == jListItem.attr("ModelKey")) // filter based on ModelKey -- use * for all { string modelList_CmdText = jListItem.attr("ModelList"); var cmd = ModelListCommand.New1(modelList_CmdText); var tmpModelObj = JsObj.O(mrb).Property_Get(cmd.Model_Name, cmd.UseGetterMethod_Model_Name); object[] optionsList = JsObj.O(tmpModelObj).Property_Get(cmd.Model_Collection, cmd.UseGetterMethod_Model_Collection).As <object[]>(); if (optionsList != null && optionsList.Length > 0) { this.Populate_SelectOptions(jListItem, cmd.Model_Collection, optionsList, cmd); } } } }
//------------------------------------------------------------------------------------------ static -- private static void GenericBinder(IMRBPattern <M, VM> mrb, string methodPropertyName, string eventType) { var onChangeItems = mrb.jF2("[" + methodPropertyName + "]"); for (int i = 0; i < onChangeItems.length; i++) { var item = onChangeItems[i]; string method = J(item).attr(methodPropertyName); Evt.Attach_ToElement(eventType, mrb, item, method, null); } }
//---------------------------------------------------------------------------------------------------- private void Bind_ModelKeyElements(IMRBPattern <M, VM> mrb, string modelKey) { M model = mrb.GetModelWithoutFiringEvents(); if (model == null) { return; } var jModelKeyElements = mrb.jF2("[ModelKey]"); if (jModelKeyElements == null) { return; } for (int i = 0; i < jModelKeyElements.length; i++) { var modelKeyAttrValues = J(jModelKeyElements[i]).attr("ModelKey").split('|'); for (int ii = 0; ii < modelKeyAttrValues.length; ii++) { string tmpModelKey = modelKeyAttrValues[ii]; if (modelKey == "*" || modelKey == tmpModelKey) { switch (jModelKeyElements[i].tagName.toUpperCase()) { case "DIV": this.ProcessModelKey_ForDivOrSpan(model, jModelKeyElements[i], tmpModelKey); break; case "SPAN": this.ProcessModelKey_ForDivOrSpan(model, jModelKeyElements[i], tmpModelKey); break; case "INPUT": this.ProcessModelKey_ForInput(model, jModelKeyElements[i], tmpModelKey); break; case "TEXTAREA": this.ProcessModelKey_ForInput(model, jModelKeyElements[i], tmpModelKey); break; case "SELECT": this.ProcessModelKey_ForSelect(model, jModelKeyElements[i], tmpModelKey); break; } } } } }