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

Re: [ydn-javascript] Re: YUI-Datatable: Automatically select a row after loading

Expand Messages
  • Neil K
    Lucas, Hope all is well.  You helped write some software in March.  Would you have time to answer a question about the same software.  I ve developed it
    Message 1 of 7 , Sep 30, 2008
    • 0 Attachment
      Lucas,

      Hope all is well.  You helped write some software in March.  Would you have time to answer a question about the same software.  I've developed it quite a bit since we last touched base.  It works fine with Opera and Firefox, but there are some problems with Explorer.

      Let me know if you have some time.  Would only take a minutes.

      Thanks,


      Neil

      --- On Tue, 9/30/08, Lucas Smith <lsmith@...> wrote:
      From: Lucas Smith <lsmith@...>
      Subject: [ydn-javascript] Re: YUI-Datatable: Automatically select a row after loading
      To: ydn-javascript@yahoogroups.com
      Date: Tuesday, September 30, 2008, 8:49 AM

      --- In ydn-javascript@ yahoogroups. com, "berli.michael"
      <berli.michael@ ...> wrote:
      >
      > Good Morning everybody!
      > I need to preselect a Yui-Datatable Row after loading. I know some
      > Data of the row, so JS should look in which row this Data is stored
      > and select it. ATM, the user can select a row:
      >
      > table.subscribe( "rowClickEvent" , table.onEventSelect Row);
      >
      > When its Datasource looks like this:
      >
      > source.responseSche ma = {
      > resultsList: "ResultSet.Result" ,
      > fields: [
      > "Field1",
      > "Field2"
      > ]};
      >
      > I know the value of Field2 in the row, the user selected, like this:
      > table.subscribe( "rowClickEvent" , function (oArgs) {
      > var elTarget = oArgs.target;
      > var oRecord = this.getRecord( elTarget) ;
      > alert(oRecord. getData(" Field2")) ;
      > });
      >
      > I save that value (doesn't matter how) and want to select, after
      > reload the table by browsers "Refresh"-Button, the row in which the
      > Data of Field2 responses to the value I saved.
      >
      > I hope you can help. Thank you !
      >
      > Best Regards
      >

      You can accomplish this (at least) two ways:
      1) use a custom formatter for the Field2 column that checks the
      incoming value against the stored value. If the incoming value
      matches, store the Record reference passed to the formatter as the
      second param. Then subscribe to the renderEvent (and possibly the
      initEvent, depending on the callback method you use) to use
      myDataTable. selectRow( the_stored_ rec).

      2) subscribe to the renderEvent (and possibly initEvent) with a method
      that loops through this.getRecordSet( ).records, checking for the
      target record. Each item in the loop will be a Record instance, so
      rec.getData( 'Field2') . When you've found your rec, break the loop and
      call myDataTable. selectRow( the_found_ rec)

      Hope this helps,
      Luke


    • Lucas Smith
      ... you have time to answer a question about the same software.  I ve developed it quite a bit since we last touched base.  It works fine with Opera and
      Message 2 of 7 , Oct 1, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, Neil K <farahneptune@...> wrote:
        >
        > Lucas,
        >
        > Hope all is well.  You helped write some software in March.  Would
        you have time to answer a question about the same software.  I've
        developed it quite a bit since we last touched base.  It works fine
        with Opera and Firefox, but there are some problems with Explorer.
        >
        > Let me know if you have some time.  Would only take a minutes.
        >
        > Thanks,
        >
        >
        > Neil

        Neil,

        Please ask your question on the mailing list (in a new thread,
        preferably). There are many people here that would be happy to help
        you work through your Explorer issues.

        Luke
      • berli.michael
        ... Could you send me an example of this solution? I tried to find sth. on yui-documentation, without success. Thanks
        Message 3 of 7 , Oct 3, 2008
        • 0 Attachment
          > subscribe to the renderEvent (and possibly initEvent) with a method
          > that loops through this.getRecordSet().records, checking for the
          > target record. Each item in the loop will be a Record instance, so
          > rec.getData('Field2'). When you've found your rec, break the loop and
          > call myDataTable.selectRow(the_found_rec)

          Could you send me an example of this solution? I tried to find sth. on
          yui-documentation, without success.

          Thanks
        • Lucas Smith
          ... http://yuiblog.com/sandbox/yui/v260/examples/datatable/select_on_render.html
          Message 4 of 7 , Oct 10, 2008
          • 0 Attachment
            --- In ydn-javascript@yahoogroups.com, "berli.michael"
            <berli.michael@...> wrote:
            >
            > > subscribe to the renderEvent (and possibly initEvent) with a method
            > > that loops through this.getRecordSet().records, checking for the
            > > target record. Each item in the loop will be a Record instance, so
            > > rec.getData('Field2'). When you've found your rec, break the loop and
            > > call myDataTable.selectRow(the_found_rec)
            >
            > Could you send me an example of this solution? I tried to find sth. on
            > yui-documentation, without success.
            >
            > Thanks
            >

            http://yuiblog.com/sandbox/yui/v260/examples/datatable/select_on_render.html
          Your message has been successfully submitted and would be delivered to recipients shortly.