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

Re: Datatable - initially hidden col width

Expand Messages
  • y_lsmith
    ... shown ... YAHOO.widget.DataTable.prototype.showColumn.call(this,col); ... There s no patch yet for initially hidden parent columns via the config.
    Message 1 of 11 , Jul 2, 2008
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "tntnashtm123" <nash.rsa@...>
      wrote:
      >
      > --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@> wrote:
      > >
      > > Tim,
      > >
      > > Ok, good to know. I'll add a test case for that scenario.
      > >
      > > In the mean time, this appears to work in my dev env:
      > > // Instantiate myDataTable
      > > myDataTable.showColumn = function (col) {
      > > var dt = this;
      > > function fixWidth(col) {
      > > var c = dt.getColumn(col), children, i;
      > > if (c) {
      > > if (c.width = YAHOO.widget.Column.prototype.minWidth) {
      > > c.width = null;
      > > }
      > >
      > > children = c.children || [];
      > > for (i = children.length - 1; i >= 0; --i) {
      > > fixWidth(children[i].key);
      > > }
      > > }
      > > }
      > >
      > > YAHOO.widget.DataTable.prototype.showColumn.call(this,col);
      > > fixWidth(col);
      > > this._syncColWidths();
      > > };
      > >
      > > Hope this helps,
      > > Luke
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, "tntnashtm123" <nash.rsa@>
      > > wrote:
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, "y_lsmith" lsmith@ wrote:
      > > > >
      > > > > >
      > > > > > Thnaks for the patch Luke, it works great, however child columns
      > > with
      > > > > > the parent hidden initially still come up with minWith when
      shown
      > > -
      > > > > > any fixes for this ?
      > > > > >
      > > > > > Thanks
      > > > > > Tim
      > > > > >
      > > > >
      > > > > I've updated the bug to include this detail. I'd be interested to
      > > see
      > > > > a sample page illustrating your use case. Specifically because
      > > > > there's another bug whereby declaring parent headers hidden at
      > > > > construction doesn't work (the column and its children are not
      > > > collapsed).
      > > > >
      > > > > You might be able to get away with something like this:
      > > > > YAHOO.widget.Column.correctAutoWidth = function () {
      > > > > if (this.width === this.minWidth &&
      > > > > this.width === YAHOO.widget.Column.prototype.minWidth) {
      > > > > this.width = null;
      > > > > if (YAHOO.lang.isArray(this.children)) {
      > > > > for (var i = this.children.length - 1; i >= 0; --i) {
      > > > > this.children[i].correctAutoWidth();
      > > > > }
      > > > > }
      > > > > }
      > > > > };
      > > > >
      > > > > // ... construct the DataTable instance, then
      > > > >
      > > > > myDataTable.showColumn = function (col) {
      > > > > var c = this.getColumn(col);
      > > > > if (c) {
      > > > >
      YAHOO.widget.DataTable.prototype.showColumn.call(this,col);
      > > > > c.correctAutoWidth();
      > > > > this._syncColWidths();
      > > > > }
      > > > > };
      > > > >
      > > > > Not thoroughly tested, so YMMV.
      > > > >
      > > > > Luke
      > > > >
      > > >
      > > >
      > > > Luke - I was/am hiding the nested cols in response to the DataTable
      > > > init event so it is not an "initially hidden" col although the
      > > > behavior is similar.
      > > >
      > > > thanks
      > > > Tim
      > > >
      > >
      >
      >
      > Thanks Luke
      >
      > That works !
      >
      > Last request - is there a patch to allow nested cols to be hidden
      > initially (via config object). As I mentitioned earlier I am hiding
      > the nested cols in responce to the init event but this is very slow in
      > IE7.
      >
      > Thanks
      > Tim
      >

      There's no patch yet for initially hidden parent columns via the
      config. However, you don't need to wait for the initEvent to declare
      a column hidden. You can do
      var myDataTable = new YAHOO.widget.DataTable('tbl',allVisibleCols,...);
      myDataTable.hideColumn('parent');

      This should be even more performant for XHR DataSources, since only
      the headers will be rendered before the repaint required by the column
      hide operation. By the time the data arrives for rendering, the
      columns will be declared as hidden so the data rows will only need to
      render once.

      Luke
    • tntnashtm123
      ... columns ... interested to ... --i) { ... DataTable ... thanks again Luke That is a great solution which never occurred to me ! Thanks for your great
      Message 2 of 11 , Jul 3, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@...> wrote:
        >
        > --- In ydn-javascript@yahoogroups.com, "tntnashtm123" <nash.rsa@>
        > wrote:
        > >
        > > --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@> wrote:
        > > >
        > > > Tim,
        > > >
        > > > Ok, good to know. I'll add a test case for that scenario.
        > > >
        > > > In the mean time, this appears to work in my dev env:
        > > > // Instantiate myDataTable
        > > > myDataTable.showColumn = function (col) {
        > > > var dt = this;
        > > > function fixWidth(col) {
        > > > var c = dt.getColumn(col), children, i;
        > > > if (c) {
        > > > if (c.width = YAHOO.widget.Column.prototype.minWidth) {
        > > > c.width = null;
        > > > }
        > > >
        > > > children = c.children || [];
        > > > for (i = children.length - 1; i >= 0; --i) {
        > > > fixWidth(children[i].key);
        > > > }
        > > > }
        > > > }
        > > >
        > > > YAHOO.widget.DataTable.prototype.showColumn.call(this,col);
        > > > fixWidth(col);
        > > > this._syncColWidths();
        > > > };
        > > >
        > > > Hope this helps,
        > > > Luke
        > > >
        > > >
        > > > --- In ydn-javascript@yahoogroups.com, "tntnashtm123" <nash.rsa@>
        > > > wrote:
        > > > >
        > > > > --- In ydn-javascript@yahoogroups.com, "y_lsmith" lsmith@ wrote:
        > > > > >
        > > > > > >
        > > > > > > Thnaks for the patch Luke, it works great, however child
        columns
        > > > with
        > > > > > > the parent hidden initially still come up with minWith when
        > shown
        > > > -
        > > > > > > any fixes for this ?
        > > > > > >
        > > > > > > Thanks
        > > > > > > Tim
        > > > > > >
        > > > > >
        > > > > > I've updated the bug to include this detail. I'd be
        interested to
        > > > see
        > > > > > a sample page illustrating your use case. Specifically because
        > > > > > there's another bug whereby declaring parent headers hidden at
        > > > > > construction doesn't work (the column and its children are not
        > > > > collapsed).
        > > > > >
        > > > > > You might be able to get away with something like this:
        > > > > > YAHOO.widget.Column.correctAutoWidth = function () {
        > > > > > if (this.width === this.minWidth &&
        > > > > > this.width === YAHOO.widget.Column.prototype.minWidth) {
        > > > > > this.width = null;
        > > > > > if (YAHOO.lang.isArray(this.children)) {
        > > > > > for (var i = this.children.length - 1; i >= 0;
        --i) {
        > > > > > this.children[i].correctAutoWidth();
        > > > > > }
        > > > > > }
        > > > > > }
        > > > > > };
        > > > > >
        > > > > > // ... construct the DataTable instance, then
        > > > > >
        > > > > > myDataTable.showColumn = function (col) {
        > > > > > var c = this.getColumn(col);
        > > > > > if (c) {
        > > > > >
        > YAHOO.widget.DataTable.prototype.showColumn.call(this,col);
        > > > > > c.correctAutoWidth();
        > > > > > this._syncColWidths();
        > > > > > }
        > > > > > };
        > > > > >
        > > > > > Not thoroughly tested, so YMMV.
        > > > > >
        > > > > > Luke
        > > > > >
        > > > >
        > > > >
        > > > > Luke - I was/am hiding the nested cols in response to the
        DataTable
        > > > > init event so it is not an "initially hidden" col although the
        > > > > behavior is similar.
        > > > >
        > > > > thanks
        > > > > Tim
        > > > >
        > > >
        > >
        > >
        > > Thanks Luke
        > >
        > > That works !
        > >
        > > Last request - is there a patch to allow nested cols to be hidden
        > > initially (via config object). As I mentitioned earlier I am hiding
        > > the nested cols in responce to the init event but this is very slow in
        > > IE7.
        > >
        > > Thanks
        > > Tim
        > >
        >
        > There's no patch yet for initially hidden parent columns via the
        > config. However, you don't need to wait for the initEvent to declare
        > a column hidden. You can do
        > var myDataTable = new YAHOO.widget.DataTable('tbl',allVisibleCols,...);
        > myDataTable.hideColumn('parent');
        >
        > This should be even more performant for XHR DataSources, since only
        > the headers will be rendered before the repaint required by the column
        > hide operation. By the time the data arrives for rendering, the
        > columns will be declared as hidden so the data rows will only need to
        > render once.
        >
        > Luke
        >

        thanks again Luke

        That is a great solution which never occurred to me !

        Thanks for your great support !

        Tim
      Your message has been successfully submitted and would be delivered to recipients shortly.