//Refresh DataSet
        public void RefreshDataSet(DataSource ds) //A.
        {
            TabItem panel = GetTabItem(ds);       //04Sep2014

            if (panel == null)
            {
                return;                //fix for crash when for some reason the existing dataset tab is not found
            }
            //04Sep2014 TabItem panel = docGroup.SelectedItem as TabItem;//we dont want active tab. Instead we need tab that matches the title "Dataset1"
            DataPanel datapanel = panel.Content as DataPanel;

            if (!ds.IsPaginationClicked) //if the refresh is called from refresh icon and not from pagination
            {
                ds.StartColindex = 0;
                ds.EndColindex   = 15;
                datapanel.InitializeDynamicColIndexes(); // then reset the start and end indexes (to 0 and 15)
            }

            ds.Changed = true;//False +ve cases:scrolling to next page, refreshing grid without modifying
            //IList list = new VirtualListDynamic(_analyticsService, ds);
            VirtualListDynamic vld = new VirtualListDynamic(_analyticsService, ds);

            vld.DataF = _analyticsService.GetDataFrame(ds);
            IList list = vld;

            panel.Tag    = ds; //panel.Tag = ds;
            datapanel.DS = ds; //sending reference
            //datapanel.sortcolnames = sortcolnames; //11Apr2014
            //datapanel.sortorder = sortorder; //14Apr2014
            datapanel.sortasccolnames  = sortasccolnames;
            datapanel.sortdesccolnames = sortdesccolnames;
            datapanel.Data             = list;
            //causing recursion datapanel.Variables = ds.Variables; //Refresh Var grid
            datapanel.DisableEnableAllNavButtons();
            //causing recursion datapanel.arrangeVarGridCols(); // arranging col positions
            datapanel.RefreshStatusBar();

            // comment following variable refresh, if dont want to update var grid from R datasets.
            // Arrangement changing. Calling the arrangeVarGridCols() will solve the arrangement problem.
            // but I guess ObservableCollection is causing problem and  throwing error for text and numeric cols
            // datapanel.Variables = ds.Variables; //uncommented for Compute 22Mar2013

            //05Mar2013 commented b'coz Tab header changed to normal header when added var in vargrid
            //panel.Header = Path.GetFileName(ds.FileName);
        }
        //Refresh DataSet
        public void RefreshDataSet(DataSource ds) //A.
        {
            TabItem panel = GetTabItem(ds);       //04Sep2014
            //04Sep2014 TabItem panel = docGroup.SelectedItem as TabItem;//we dont want active tab. Instead we need tab that matches the title "Dataset1"
            DataPanel datapanel = panel.Content as DataPanel;

            if (!ds.IsPaginationClicked) //if the refresh is called from refresh icon and not from pagination
            {
                ds.StartColindex = 0;
                ds.EndColindex   = 15;
                datapanel.InitializeDynamicColIndexes(); // then reset the start and end indexes (to 0 and 15)
            }


            //IList list = new VirtualListDynamic(_analyticsService, ds);
            VirtualListDynamic vld = new VirtualListDynamic(_analyticsService, ds);

            vld.DataF = _analyticsService.GetDataFrame(ds);
            IList list = vld;

            panel.Tag    = ds; //panel.Tag = ds;
            datapanel.DS = ds; //sending reference
            //datapanel.sortcolnames = sortcolnames; //11Apr2014
            //datapanel.sortorder = sortorder; //14Apr2014
            datapanel.sortasccolnames  = sortasccolnames;
            datapanel.sortdesccolnames = sortdesccolnames;
            datapanel.Data             = list;


            // comment following variable refresh, if dont want to update var grid from R datasets.
            // Arrangement changing. Calling the arrangeVarGridCols() will solve the arrangement problem.
            // but I guess ObservableCollection is causing problem and  throwing error for text and numeric cols
            // datapanel.Variables = ds.Variables; //uncommented for Compute 22Mar2013

            //05Mar2013 commented b'coz Tab header changed to normal header when added var in vargrid
            //panel.Header = Path.GetFileName(ds.FileName);
        }