[CLOSED] on click cell in grid row removed

  1. #1

    [CLOSED] on click cell in grid row removed



    Hi,
    I had a gird with more than 100 columns, i used cellclick java script function, in that i refreshed a gridrow
    when i click the cell at 50th column position (focus not set in that column)
    function cellClick(grid, rowIndex, colIndex, e) {
    
    
    CurrentColIndex = colIndex;
    
    
    CurrentRow = rowIndex; 
    
    
    var record = grid.getStore().getAt(rowIndex); // Get the Record
    
    
    grid.getView().refreshRow(record);
    
    
    }

  2. #2

    RE: [CLOSED] on click cell in grid row removed

    hmmm. I was unable to reproduce the problem based on your description.

    100 columns in a GridPanel is a lot of columns. What is the usecase that requires so many columns?

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] on click cell in grid row removed



    In order to set rights for the user i need to bind nearly 100 columns in a grid, i used cellclick java script function , in that java script i refreshed a gridrow ( as i already posted the code) when i click the cell at cell at 100th column it get collapsed


    
    Code Behind : CS File
    
    using System;
    
    
    using System.Collections;
    
    
    using System.Collections.Generic;
    
    
    using System.Configuration;
    
    
    using System.Data;
    
    
    using System.Linq;
    
    
    using System.Web;
    
    
    using System.Web.Security;
    
    
    using System.Web.UI;
    
    
    using System.Web.UI.HtmlControls;
    
    
    using System.Web.UI.WebControls;
    
    
    using System.Web.UI.WebControls.WebParts;
    
    
    using System.Xml.Linq;
    
    
    using Coolite.Ext.Web;
    
    
    using Coolite.Utilities;
    
    
    using System.Text;
    
    
    using System.Xml;
    
    
    using System.IO;
    
    
    using System.Text.RegularExpressions;
    
    
    public partial class _Default : System.Web.UI.Page 
    
    
    {
    
    
    protected void Page_Load(object sender, EventArgs e)
    
    
    {
    
    
    System.Data.DataTable Dt = new System.Data.DataTable();
    
    
    Dt.Columns.Add("User Name");
    
    
    for (int i = 0; i < 50; i++)
    
    
    {
    
    
    Dt.Columns.Add("Rights" + i.ToString()); 
    
    
    }
    
    
    
    
    
    for (int j = 0; j < 5; j++)
    
    
    {
    
    
    System.Data.DataRow Dr = Dt.NewRow();
    
    
    Dr[0] = "User1"; 
    
    
    for (int i = 0; i < 50; i++)
    
    
    {
    
    
    Dr[i + 1] = "N";
    
    
    }
    
    
    Dt.Rows.Add(Dr); 
    
    
    }
    
    
    
    
    
    Coolite.Ext.Web.JsonReader jr = new Coolite.Ext.Web.JsonReader();
    
    
    jr.ReaderID = "";
    
    
    for (int Counter = 0; Counter < Dt.Columns.Count; Counter++)
    
    
    {
    
    
    RecordField RF = new RecordField();
    
    
    RF.Name = Dt.Columns[Counter].ToString();
    
    
    RF.Type = RecordFieldType.String;
    
    
    jr.Fields.Add(RF);
    
    
    Coolite.Ext.Web.Column COL = new Coolite.Ext.Web.Column();
    
    
    this.GrdPnl1.ColumnModel.Columns.Insert(Counter, COL);
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].ColumnID = Dt.Columns[Counter].ToString();
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].DataIndex = Dt.Columns[Counter].ToString();
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].Header = Dt.Columns[Counter].ToString();
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].MenuDisabled = true;
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].Sortable = false;
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].Resizable = false;
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].Width = 150;
    
    
    if (Counter > 1)
    
    
    this.GrdPnl1.ColumnModel.Columns[Counter].Renderer.Fn = "ImageRender";
    
    
    }
    
    
    this.ScriptManager1.AddScript("SetArrayDimension(" + Dt.Rows.Count + ", " + (Dt.Columns.Count) + ");");
    
    
    DataSet Ds = new DataSet();
    
    
    
    
    
    
    
    
    Ds.Tables.Add(Dt);
    
    
    Store1.Reader.Add(jr);
    
    
    this.Store1.DataSource = Ds;
    
    
    this.Store1.DataBind();
    
    
    }
    
    
    }
    
    
    
    
    Form Design:-
    
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    
    <head runat="server">
    
    
    <title></title>
    
    
    <script type="text/javascript">
    
    
    var MyArray = new Array(2);
    
    
    var CurrentColIndex = ""
    
    
    function ImageRender(value, meta, record, rowIndex, colIndex, store) {
    
    
    meta.attr = "style='text-align:center;'";
    
    
    if (CurrentColIndex == colIndex) {
    
    
    if (MyArray[rowIndex][colIndex] == "N") {
    
    
    MyArray[rowIndex][colIndex] = "Y";
    
    
    return "<img class='imgEdit' style='cursor:pointer;' src='images/icons/tick_blue.png' />";
    
    
    }
    
    
    else if (MyArray[rowIndex][colIndex] == "Y") {
    
    
    MyArray[rowIndex][colIndex] = "N";
    
    
    return "";
    
    
    }
    
    
    }
    
    
    else {
    
    
    if (MyArray[rowIndex][colIndex] == "Y") {
    
    
    return "<img class='imgEdit' style='cursor:pointer;' src='images/icons/tick_blue.png' />";
    
    
    }
    
    
    else if (MyArray[rowIndex][colIndex] == "N") {
    
    
    return "";
    
    
    }
    
    
    }
    
    
    }
    
    
    function SetArrayDimension(Row, Col) {
    
    
    CurrentColIndex = "";
    
    
    TotalCol = Col;
    
    
    TotalRow = Row; 
    
    
    for (i = 0; i < Row; i++)
    
    
    MyArray[i] = new Array(Col)
    
    
    for (i = 0; i < Row; i++) {
    
    
    for (j = 0; j < Col; j++) {
    
    
    MyArray[i][j] = "N" 
    
    
    }
    
    
    }
    
    
    }
    
    
    function cellClick(grid, rowIndex, colIndex, e) {
    
    
    CurrentColIndex = colIndex;
    
    
    CurrentRow = rowIndex; 
    
    
    var record = grid.getStore().getAt(rowIndex); // Get the Record
    
    
    grid.getView().refreshRow(record);
    
    
    }
    
    
    </script>
    
    
    </head>
    
    
    <body >
    
    
    <form id="form1" runat="server">
    
    
    
    
    
    <ext:ScriptManager ID="ScriptManager1" runat="server" RenderStyles="File" Theme="Slate">
    
    
    </ext:ScriptManager> 
    
    
    <ext:Store ID="Store1" runat="server" AutoLoad="true"> 
    
    
    </ext:Store> 
    
    
    <ext:GridPanel StripeRows="true" ID="GrdPnl1" runat="server" Height="100" AutoScroll ="true" Width="200" StoreID="Store1" >
    
    
    <Listeners>
    
    
    <CellClick Fn="cellClick" /> 
    
    
    </Listeners> 
    
    
    </ext:GridPanel>
    
    
    
    
    
    
    </form>
    
    
    </body>
    
    
    </html>
  4. #4

    RE: [CLOSED] on click cell in grid row removed

    I face the same problem......
    When there are many columns >15, The focus can't focus on the selected cell...........
    Do you have the solution??????????
    Chinh

Similar Threads

  1. Replies: 1
    Last Post: Jul 10, 2012, 11:16 AM
  2. Replies: 0
    Last Post: May 12, 2012, 11:24 AM
  3. Replies: 1
    Last Post: Apr 11, 2012, 12:52 PM
  4. Replies: 8
    Last Post: May 17, 2010, 11:11 AM

Posting Permissions