Loading ...
Sorry, an error occurred while loading the content.

Disable cell/row in YUI data table

Expand Messages
  • hagitelk
    Hi, I m new in YUI. I need to use the editable datatable with an option to disable specific rows or cells. Is there a way to do this? Thanks
    Message 1 of 4 , Sep 25, 2009
    • 0 Attachment
      Hi,

      I'm new in YUI. I need to use the editable datatable with an option to disable specific rows or cells. Is there a way to do this?
      Thanks
    • david.bill1982
      Try the below code. myDataTable.subscribe( cellClickEvent ,function(oArgs) { //get the record for the row var record = myDataTable.getRecord(oArgs.target);
      Message 2 of 4 , Sep 28, 2009
      • 0 Attachment

        Try the below code.

        myDataTable.subscribe('cellClickEvent',function(oArgs) {
        //get the record for the row
        var record =  myDataTable.getRecord(oArgs.target);

        //data for the record
        var rData = record.getData();

        //get the column
        var column = myDataTable.getColumn(oArgs.target);

        //use your condition here
        if(rData.id != 10){
        myDataTable.onEventShowCellEditor(oArgs);
        }
        });

        Thanks,
        Bill


      • hagitelk
        Thanks for the response. This idea will work, but the problem is that the user will have to click the cell in order to know if it is editable or not, which is
        Message 3 of 4 , Oct 2, 2009
        • 0 Attachment
          Thanks for the response.
          This idea will work, but the problem is that the user will have to click the cell in order to know if it is editable or not, which is not user friendly. Is there a way to display the cell as grayed out, so that the user will see which cells are editable or not without clicking the table?
          Thanks!

          --- In ydn-javascript@yahoogroups.com, "david.bill1982" <david.bill1982@...> wrote:
          >
          >
          > Try the below code.
          > myDataTable.subscribe('cellClickEvent',function(oArgs) {
          > //get the record for the row var record =
          > myDataTable.getRecord(oArgs.target);
          > //data for the record
          > var rData = record.getData();
          >
          > //get the column
          > var column = myDataTable.getColumn(oArgs.target);
          > //use your condition here
          > if(rData.id != 10){
          > myDataTable.onEventShowCellEditor(oArgs); }
          > });
          > Thanks,Bill
          >
        • Satyam
          Editable cells have the className yui-dt-editable assigned to them. You can define a style for those, see: http://www.satyam.com.ar/yui/widgetstyles.html The
          Message 4 of 4 , Oct 2, 2009
          • 0 Attachment
            Editable cells have the className yui-dt-editable assigned to them. You
            can define a style for those, see:

            http://www.satyam.com.ar/yui/widgetstyles.html

            The already uses that style, the cursor is different over editable than
            on non-editable cells. You can further add color if you wish.

            Satyam

            hagitelk escribió:
            > Thanks for the response.
            > This idea will work, but the problem is that the user will have to click the cell in order to know if it is editable or not, which is not user friendly. Is there a way to display the cell as grayed out, so that the user will see which cells are editable or not without clicking the table?
            > Thanks!
            >
            > --- In ydn-javascript@yahoogroups.com, "david.bill1982" <david.bill1982@...> wrote:
            >
            >> Try the below code.
            >> myDataTable.subscribe('cellClickEvent',function(oArgs) {
            >> //get the record for the row var record =
            >> myDataTable.getRecord(oArgs.target);
            >> //data for the record
            >> var rData = record.getData();
            >>
            >> //get the column
            >> var column = myDataTable.getColumn(oArgs.target);
            >> //use your condition here
            >> if(rData.id != 10){
            >> myDataTable.onEventShowCellEditor(oArgs); }
            >> });
            >> Thanks,Bill
            >>
            >>
            >
            >
            >
            >
            > ------------------------------------
            >
            > Yahoo! Groups Links
            >
            >
            >
            > ------------------------------------------------------------------------
            >
            >
            > No virus found in this incoming message.
            > Checked by AVG - www.avg.com
            > Version: 8.5.409 / Virus Database: 270.14.2/2408 - Release Date: 10/01/09 18:23:00
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.