PDA

View Full Version : Checking TabPanel Items In Server - Side (Example)



ismailkocacan
Aug 12, 2015, 8:38 AM
Hi Guys

I was asked that question (http://forums.ext.net/showthread.php?59882-How-to-handle-treepanel-clicked-node-details(id-text-tag-or-as-Ext-Net-Node-object)-at-server-side)

This trick,related above my question.

How to check TabPanelItems in server-side. ?

I have tried in server-side methods.

Method 1 (not worked)

TabPanel tabPanel = X.GetCmp<TabPanel>("tabContainer");
if (tabPanel.FindControl("tab1") != null) // always working
{
//to do
}

Method 2 (not worked)

TabPanel tabPanel = X.GetCmp<TabPanel>("tabContainer");
Panel tab1= X.GetCmp<Panel>("tab1"); // always working...
if (tab1!=null)
{
// to do
}


Working Method.


treePanel.DirectEvents.ItemClick.Before = "o.extraParams.param1 = record.data.id; o.extraParams.param2 = record.data.text; var tagId = record.raw['tag']; o.extraParams.param3 = tagId; var tab = App.tabContainer.getComponent('Id'+tagId); var result = false; if (tab) { result = true; } else { result = false; } o.extraParams.tabIsExist=result; ";



public class MenuController : Controller
{
public ActionResult TreePanelClickHandler(string param1,string param2,string param3,bool tabIsExist)
{
if (tabIsExist)
{
// todo
}
X.Msg.Alert("server-side:", param1 + "\n" + param2+ "\n" + param3).Show();
AjaxResult r = new AjaxResult();
return r;
}
}

Daniil
Aug 13, 2015, 11:43 AM
Hi @ismailkocacan,

A Controller cannot have access to real components for a View.

.GetCmp<>() is only a proxy. Here you can find more details:
http://forums.ext.net/showthread.php?38701&p=176681&viewfull=1#post176681

As for your solution, it is correct and, generally speaking, the only solution.

ismailkocacan
Aug 14, 2015, 7:08 AM
Thanks for interest,information,response @Daniil

this sample,it might be nice to add mvc explorer...

Daniil
Aug 14, 2015, 9:13 AM
Thank you for the suggestion!