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

Re: [ydn-javascript] Re: Auto close timer for Simple Dialog, and Datatable question w/modal external src

Expand Messages
  • Satyam
    You are setting the listener for the hideit button before the function is defined. I know it is just a snip so the order in your actual code might be
    Message 1 of 6 , Jun 29, 2009
    • 0 Attachment
      You are setting the listener for the hideit button before the function
      is defined. I know it is just a snip so the order in your actual code
      might be different, but if the order is what you show here, the listener
      for hideit won't be called.

      james.piechocki escribió:
      > Here is an example of the code issue I am having.
      > And if I call a trigger second time from an cell that triggers this panel, it appends the new tabs under the old tabs. Destroy doesnt work, any ideas on how to make the first set of tabs disappear after it is closed (hidden)
      >
      > var panel = new YAHOO.widget.Panel("PanelDetalle", {visible:false,height:'550px', draggable:true, close:true, width:'600px', fixedcenter: true,modal:true,constraintoviewport:true} );
      > panel.setHeader("");
      > panel.setBody("");
      > panel.setFooter("End of Panel");
      > panel.render(document.body);
      > YAHOO.util.Event.addListener("hideit", "click", hide);
      >
      > var destruct = function (){
      > panel.destroy();
      > }
      >
      >
      > var show = function (recordId,caption,cell) {
      > var tabView = new YAHOO.widget.TabView();
      > tabView.addTab( new YAHOO.widget.Tab({
      > label: 'Invoices',
      > dataSrc: '/fms/jobs_ticket_details.php?ticket='+recordId,
      > cacheData: false,
      > active: true
      > }));
      >
      > tabView.addTab( new YAHOO.widget.Tab({
      > label: 'Tab 2',
      > dataSrc: 'assets//news.php?&query=firefox+browser',
      > cacheData: false
      > }));
      >
      > tabView.addTab( new YAHOO.widget.Tab({
      > label: 'Tab 3',
      > dataSrc: 'assets//news.php?&query=firefox+browser',
      > cacheData: false
      > }));
      >
      > tabView.addTab( new YAHOO.widget.Tab({
      > label: 'Tab 4',
      > dataSrc: 'assets//news.php?&query=firefox+browser',
      > cacheData: false
      > }));
      >
      > baseRecordId = recordId;
      > panel.setHeader(caption);
      > panel.cfg.setProperty("visible", true);
      > tabView.set('activeIndex', 0);
      >
      > tabView.appendTo(panel.body);
      > tabView.on('activeTabChange', function (ev) {
      > switch(tabView.getTabIndex(ev.newValue)) {
      > case 0:
      > setTable1();
      > break;
      > case 1:
      > setTable2();
      > break;
      > case 2:
      > setTable3();
      > break;
      > case 3:
      > setTable4();
      > break;
      > }
      > });
      > };
      >
      > var hide = function () {
      > panel.cfg.setProperty("visible", false);
      > panel.destroy();
      > };
      >
      >
      >
      > Not ALL CODE HERE JUST SKIPPED TO GIVE YOU AN IDEA
      >
      > /* OPEN CLOSED EDIT VARS */
      > var JobOpenclosedEdit = new YAHOO.widget.DropdownCellEditor({dropdownOptions:['Open','Closed'],disableBtns: false, asyncSubmitter: function(callback, newValue) {
      > var record = this.getRecord(),
      > column = this.getColumn(),
      > oldValue = this.value,
      > datatable = this.getDataTable();
      > if(oldValue == newValue)
      > {
      > callback();
      > }
      > YAHOO.util.Connect.asyncRequest(
      > 'POST',
      > 'job_updates_ind.php', // PHP PAGE
      > {
      > success:function(o) {
      > var r = YAHOO.lang.JSON.parse(o.responseText);
      > if (r.replyCode == 201) {
      > yuiInfoAlert('Job Status updated', r.replyText);
      > callback(true, newValue);
      > } else {
      > alert(r.replyText);
      > callback();
      > }
      > },
      > failure:function(o) {
      > alert(o.statusText);
      > callback();
      > },
      > scope:this
      > },
      > 'KT_Update9=1&action=DueDate&codeRefOld=' + escape(oldValue) + '&codeRef=' + escape(newValue) + '&id=' + record.getData('id')
      > );
      >
      > }});
      >
      > // Column definitions
      > var myColumnDefs = [ // sortable:true enables sorting
      > {key:"jobnum",label:"Job Number",sortable:true},
      > {key:"company_owner",label:"Company", sortable:true, editor: new YAHOO.widget.DropdownCellEditor(JobCompanyEdit)},
      > {key:"client",label:"Client",sortable:true},
      > {key:"territory",label:"Territory",sortable:true, editor: new YAHOO.widget.DropdownCellEditor(JobTerritoryEdit)},
      > {key:"ponum"},
      > {key:"ordercode",label:"Order Code",sortable:true, editor: new YAHOO.widget.DropdownCellEditor(JobORDERCODEEdit)},
      > {key:"name",label:"Job Name",sortable:true, editor: new YAHOO.widget.TextareaCellEditor(JobNameEdit)},
      > {key:"btype",label:"Billing Type",sortable:true, editor: new YAHOO.widget.TextareaCellEditor(JobBTypesEdit)},
      > {key:"amt", label:"Amount",sortable:false, formatter:YAHOO.widget.DataTable.formatCurrency },
      > {key:"est", label:"Estimate",sortable:false, formatter:YAHOO.widget.DataTable.formatNumber},
      > {key:"due",label:"Due Date",sortable:true, formatter:YAHOO.widget.DataTable.formatDate, editor: new YAHOO.widget.DateCellEditor(JobDueDateEdit)},
      > {key:"status",label:"Status", editor: new YAHOO.widget.DropdownCellEditor(JobOpenclosedEdit)},
      > {key:"prog",label:"Program",sortable:true, editor: new YAHOO.widget.DropdownCellEditor(JobNPROGEdit)},
      > {key:"emp_owner",label:"Project Manager",sortable:true, editor: new YAHOO.widget.DropdownCellEditor(JobPMEdit)},
      > {key:"edit",label:"Edit"},
      > {key:"invoices",hidden:true},
      > {key:"expenses",hidden:true},
      > {key:"copies",hidden:true},
      > {key:"deliverable",hidden:true},
      > {key:"grouping",hidden:true},
      > {key:"delivery",hidden:true},
      > {key:"invoicing",hidden:true},
      > {key:"createdate",hidden:true},
      > {key:"areas",hidden:true},
      > {key:"id",hidden:true},
      > {key:"id",hidden:true},
      > {key:"bclient",hidden:true}
      > ];
      >
      > // DataSource instance
      > var myDataSource = new YAHOO.util.DataSource("json_jobs_dyn_t.php?action=1&<? if(empty($status)){ echo "status=o&";}else{echo "status=$status&";}?><? if($_GET['territory'] && $_GET['territory']!=0){ echo "territory=".$_GET['territory']."&";}?><? if($_GET['prog']>0){ echo "prog=".$_GET['prog']."&";}?><? if($_GET['ordercode']>0){ echo "ordercode=".$_GET['ordercode']."&";}?><? if($_GET['emp_owner']>0){ echo "emp_owner=".$_GET['emp_owner']."&";}?>");
      > myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
      > myDataSource.responseSchema = {
      > resultsList: "records",
      > fields: [
      > {key:"id"},
      > {key:"jobnum"},
      > {key:"company_owner"},
      > {key:"client"},
      > {key:"bclient"},
      > {key:"territory"},
      > {key:"areas"},
      > {key:"ponum"},
      > {key:"ordercode"},
      > {key:"name"},
      > {key:"btype"},
      > {key:"amt", parser:"number"},
      > {key:"est", parser:"number"},
      > {key:"due",parser:"date"},
      > {key:"status"},
      > {key:"prog"},
      > {key:"invoices"},
      > {key:"expenses"},
      > {key:"copies"},
      > {key:"deliverable"},
      > {key:"grouping"},
      > {key:"delivery"},
      > {key:"invoicing"},
      > {key:"createdate"},
      > {key:"edit"},
      > {key:"emp_owner"}
      > ],
      > metaFields: {
      > totalRecords: "totalRecords" // Access to value in the server response
      > }
      > };
      >
      > // DataTable configuration
      > var myConfigs = {
      > initialRequest: "sort=jobnum&dir=asc&startIndex=0&results=50", // Initial request for first page of data
      > dynamicData: true, // Enables dynamic server-driven data
      > paginator: new YAHOO.widget.Paginator({
      > rowsPerPage: 10,
      > template: YAHOO.widget.Paginator.TEMPLATE_ROWS_PER_PAGE,
      > rowsPerPageOptions: [10,25,50,100,500],
      > pageLinks: 25 }) // Enables pagination
      > };
      >
      > // DataTable instance
      > var myDataTable = new YAHOO.widget.DataTable("dynamicdata", myColumnDefs, myDataSource, myConfigs);
      > // Update totalRecords on the fly with value from server
      > myDataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
      > oPayload.totalRecords = oResponse.meta.totalRecords;
      > return oPayload;
      > }
      >
      > var highlightEditableCell = function(oArgs) {
      > var elCell = oArgs.target;
      > if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
      > this.highlightCell(elCell);
      > }
      > };
      >
      > myDataTable.subscribe("cellMouseoverEvent", highlightEditableCell);
      > myDataTable.subscribe("cellMouseoutEvent", myDataTable.onEventUnhighlightCell);
      > myDataTable.subscribe("cellClickEvent", myDataTable.onEventShowCellEditor);
      > myDataTable.subscribe("cellMouseoverEvent", myDataTable.onEventHighlightCell);
      > myDataTable.subscribe("cellMouseoutEvent", myDataTable.onEventUnhighlightCell);
      >
      >
      > myDataTable.on('cellClickEvent',function(oArgs) {
      > var target = oArgs.target,
      > record = this.getRecord(target),
      > column = this.getColumn(target);
      > if (column.key == 'edit') {
      > show(record.getData('id'),record.getData('jobnum'),target);
      > }
      > });
      >
      >
      > return {
      > ds: myDataSource,
      > dt: myDataTable
      > };
      >
      >
      >
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
      >
      >> I was assuming your alert is not an actual window.alert() statement,
      >> because that one you cannot hide. I assumed you would be using a
      >> SimpleDialog widget from the container family, which you can hide simply
      >> by calling method hide().
      >>
      >> Satyam
      >>
      >>
      >> james.piechocki escribi�:
      >>
      >>> Satyam,
      >>> Thank you, that helped a bunch, but I am at a loss for how to clear the panel body, i tried destroy and forceContainerRedraw and after i use those, I can not reproduce the panel body.. And if I leave it with out destroy or forceContainerRedraw it just writes the new tabs under the old tabs. It appends to the body after the tabs..
      >>> Any ideas?
      >>>
      >>>
      >>>
      >>>
      >>> --- In ydn-javascript@yahoogroups.com, Satyam <satyam@> wrote:
      >>>
      >>>
      >>>> james.piechocki escribi�:
      >>>>
      >>>>
      >>>>> I am using the datatable and inline editing, and I pull up an alert that shows what was changed, the client has to click ok for it to disappear, does anyone know of a way for it to disappear after 2 seconds or so?
      >>>>>
      >>>>>
      >>>>>
      >>>> use the native window.setTimeout or YUI's later method:
      >>>>
      >>>> http://developer.yahoo.com/yui/docs/YAHOO.lang.html#method_later
      >>>>
      >>>>
      >>>>
      >>>>
      >>>>> Also can I import a html form somehow using a column in the datatable, when clicked it pulls up a modal that calls a page from the database
      >>>>>
      >>>>>
      >>>>>
      >>>> Not sure what you are asking for, but whatever YUI provides, you will
      >>>> have to glue it together. You can respond to click events anyplace in
      >>>> the DataTable. I don't understand the 'import a form' part and yes, you
      >>>> can certainly show anything you care in a modal dialog, you mean an
      >>>> auxiliary DataTable? Sure, see:
      >>>>
      >>>> http://www.satyam.com.ar/yui/#TableWithDetails
      >>>>
      >>>> Satyam
      >>>>
      >>>>
      >>>>
      >>>>> ------------------------------------
      >>>>>
      >>>>> Yahoo! Groups Links
      >>>>>
      >>>>>
      >>>>>
      >>>>> ------------------------------------------------------------------------
      >>>>>
      >>>>>
      >>>>> No virus found in this incoming message.
      >>>>> Checked by AVG - www.avg.com
      >>>>> Version: 8.5.339 / Virus Database: 270.12.93/2206 - Release Date: 06/27/09 17:55:00
      >>>>>
      >>>>>
      >>>>>
      >>>>>
      >>>
      >>>
      >>> ------------------------------------
      >>>
      >>> Yahoo! Groups Links
      >>>
      >>>
      >>>
      >>> ------------------------------------------------------------------------
      >>>
      >>>
      >>> No virus found in this incoming message.
      >>> Checked by AVG - www.avg.com
      >>> Version: 8.5.339 / Virus Database: 270.12.94/2208 - Release Date: 06/29/09 05:54:00
      >>>
      >>>
      >>>
      >
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.339 / Virus Database: 270.12.94/2208 - Release Date: 06/29/09 05:54:00
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.