|
I found a way!!!
Say I want to render that:
<rs-tabpanel>
<tab>
<header>01</header>
<content>tab 01</content>
</tab>
<tab>
<header>02 <i>hehe</i></header>
<content>no worries!</content>
</tab>
<tab>
<header>hah</header>
<content><b>uit's alive</b></content>
</tab>
<tab>
<header>foo</header>
<content>snafu!</content>
</tab>
</rs-tabpanel>
I used the following TypeScript VueJS component
function guid(): string {
var d = Date.now();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
function createHTML(name: string, attributes: any): HTMLElement {
var res = document.createElement(name);
for (var k in attributes) {
res.setAttribute(k, attributes[k]);
}
return res;
}
module RSComponents {
export class RSTabPanel extends Vue {
constructor(options: any) {
var init = {
template: '#RSTabPanel',
};
$.extend(options, init);
var el: HTMLElement = options.el;
if (el.children.length > 0) {
var panel = createHTML('div', { role: 'tabpanel', class: 'panel panel-default' });
var headers = createHTML('ul', { role: 'tablist', class: 'nav nav-tabs' });
var contents = createHTML('div', { class: 'tab-content panel-body' });
for (var i = 0; i < el.children.length; i++) {
var item: HTMLUnknownElement = <HTMLUnknownElement>el.children[i];
var h: HTMLUnknownElement = <HTMLUnknownElement>item.children.item(0);
var c: HTMLUnknownElement = <HTMLUnknownElement>item.children.item(1);
var uid = guid();
var attrs: any = { role: 'presentation' };
if (i == 0) attrs['class'] = 'active';
var he = createHTML('li', attrs);
var heLink = createHTML('a', { href: '#' + uid, role: "tab", 'data-toggle': 'tab' });
heLink.innerHTML = h.innerHTML;
he.appendChild(heLink);
attrs = { role: 'tabpanel', class: 'tab-pane', id: uid };
if (i == 0) attrs['class'] += ' active';
var ce = createHTML('li', attrs);
ce.innerHTML = c.innerHTML;
headers.appendChild(he);
contents.appendChild(ce);
}
panel.appendChild(headers);
panel.appendChild(contents);
options.template = panel.outerHTML;
}
super(options);
}
}
Vue.component('rs-tabpanel', RSTabPanel);
}
The important bit here, I replace the template option is there are children in my component!
modified 25-Jan-15 5:13am.
|
|
|
|
|
Did you realized that you wrote like 50 lines of code to create a 10 line HTML?
That's hardly 'templating' ...
Anyway it works for you so it is good!!!
You may missed this however: http://knockoutjs.com/documentation/template-binding.html[^]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: Did you realized that you wrote like 50 lines of code to create a 10 line HTML?
This basic bootstrap TabControl sample is... 15 lines of very cumbersome HTML that are hard to get right everytime!!
I can't bear to write that again and again, with new (tab) ID, without bugs!
<div role="tabpanel">
<!--
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>
<!--
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">...</div>
<div role="tabpanel" class="tab-pane" id="profile">...</div>
<div role="tabpanel" class="tab-pane" id="messages">...</div>
<div role="tabpanel" class="tab-pane" id="settings">...</div>
</div>
</div>
|
|
|
|
|
Visual Studio snippets?
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Now that you said it, VS Snippets are a nice quick solution!
But also now that my .js version TabControl exists, I like it more!
I dug further into... WebComponents[^]! But it turns out that document.registerElement() is unsupported on my IE11!.. pfff...
|
|
|
|
|
There are several methods can be importantly used for the joomla boot strap,and each of them is importantly explained by the various methods in a perfect manner.
best cardiology hospitals in kerala
|
|
|
|
|
Hello,
My situation is this. Where I work the "system" is asp based (both web forms and mvc). It is internal, so from that point of view isn't forced to be a website. Typically there is a lot of reading up of data from a database, displaying it, a user manipulating it, saving it back to the database - this kind of thing. I am from a more desktop development background, so am trying to be as objective as possible. I quite like web development, but a large part of me is conflicted - is asp really the right solution for this use case? For example I have found that if you try to make something like a spreadsheet on an asp form with logic in the background you have to write a fair bit of javascript to get normal behaviour, e.g. tabbing around from cell to cell (because when you tab out that can incur recalculations and thus post-backs - you then can loose the right focus). I have had experience working with WPF (making a windows 8 app) and in my object opinion it was an extremely nice way to make a UI. On the internet it is very hard to get good opinions because so many of them seem to be biased (people treating languages as religions) and extreme e.g. ("wpf is DEAD", "no there is a new version coming it's ALIVE"). I absolutely am not biased, I can see the advantages of web applications - surfing, not installing etc. I'd appreciate some advice from well seasoned developers, what do you think is the best way to go in this use case, and as time goes by, are desktop applications starting to fade away?
|
|
|
|
|
I understand your situation.
I've converted to writing all of my applications for my company as web applications because:
1) Much easier to deploy. (Just update the website)
2) Works out better for remote users
3) More secure. If a laptop is stolen, lost or employee is terminated, their network access is denied so they can no longer access corporate data.
I'm sure there are other "pros" you can think of ...
Regarding developing "rich" user experience, have you considered using 3rd party controls ?
I have been using WinForms controls from Developer Express for the past 6 years and found that their products and support are excellent.
I have attended 2 of their Road Shows and met with their engineers and they are very friendly and helpful.
I don't want to violate and posting rules and I do not work for DevExpress, but I do highly recommend looking into their tools.
https://www.devexpress.com/[^]
You can download their tools and try them out before you buy.
|
|
|
|
|
Hi, Thanks a lot for your reply that's a good helper. Cheers!
|
|
|
|
|
Here is an argument from the other side - I prefer desktop applications.
I took our organisation to Silverlight because the result was almost as rich as winforms which we were using. This was a brilliant move right up till Microsoft killed Silverlight. Do NOT get me started on that decision!
Since then we have had a senior dev trying to duplicate the functionality of one of our apps using MVC/SP and Telerik controls. He is failing.
He is also of the opinion that development time will be at least double using the current web stack (we have excellent Silverlight skills that transfer directly to WPF).
Web deployment is simpler and if you have remote or international users it makes sense to use a web platform but for local, internal apps I would use desktop and clickonce.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your reply. Very interesting to hear, because from some idealistic point of view I can understand that people can say that web is better, but in my experience comparing asp webforms and mvc compared to wpf, is that you can just do things so much more easily with wpf and have no irritations to deal with. Also, I've considered, how about having a shared code base, then you can create an application with wpf, make a win 8 version of it and a phone version of it (but sadly not many smart phones are windows ones).
|
|
|
|
|
Picaro2015 wrote: how about having a shared code base I believe this can work if you use JSon as your data format from the service. Also I would us an MVC dataservice rather than a WCF, your mobile platforms may balk at talking to a WCF whereas OData is more acceptable.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Guys any help on this? I have a dialog box triggered by a button click that calls my php script to generate a form which needs to be filled and submitted. I want to do the sending and conformation via Ajax. I have been recoding and researching for a few days but nothing on StackExchange or other websites help me with it. Here's the code:
Dialog box snippet;
$k('#CreateTable').click(function(e){
e.preventDefault();
var Call = $k('#CreateTable').attr('value');//.attr('id');
var util = $k(this).attr('id');//.attr('id');
$k('#dialog').dialog({
autoOpen: false,
title: 'Running Utility for: '+Call,
modal: true,
width: 450,
close: function(event, ui) {
$k("#dialog").dialog('destroy');//event.target
}//END CLOSE
}).dialog('open');
var utility = { 'utility' : util };
$k.ajax({
type: "post",
url: "inc/runUtilities.php",
dataType: "html",
data: utility,
success: function(data) {
$k('#DlgTxt').html(data).fadeIn('slow');
}
});
//return false;
});//END DIALOG
The PHP snippet;
Its part of a class that returns the $show variable.
$show .= "";
// action='".$_SERVER['REQUEST_URI']."'
$show .= '
';
$query = "SHOW COLUMNS FROM `".$_SESSION['WorkTable']."`";
if($output = mysqli_query($this->MySQLCxn->MySQLCxn, $query))
{
$columns = array();
while($row = mysqli_fetch_assoc($output))
{
if($row['Field'] == 'id') {}
else
$show .= '
';
}
}
$show .= '
'.@$row['Field'].': |
| | Submit | Create contact
| |
';
And the JQuery that i am currently using trying to have it call my php to process the form being sent.
var $j = jQuery.noConflict();
(function($j){
$j(document).ready(function() {
$j("#cContactSbmt").click(function(e){
//I've tried .on(), .live(), .submit(), .trigger()
e.preventDefault();
alert('cContactSbmt clicked...');
$j.ajax ({
type:"POST",
url:"inc/runUtilities.php",
data: $j(this).serialize(),
success: function(msg){
$j("#thanks").html(msg)
$j(this).modal('hide');
},
error: function(){
alert("failure");
}
});
});
});
})($j);
For some reason its not working nothing showing up in the console as well. again: i have a dialog box that gets populated via Ajax with a php generated from that needs to get submitted to another php script that is to process it and reply to the dialogs. Any suggestions?
|
|
|
|
|
I have been delving into web development quite heavily recently. I have searched all over the internet for what is the best framework to use. I know that what would be considered the "best" can be affected by what I want to do, specifically.
I want to create websites that are easily to update (minimal code changes), looks great, and is relatively easy to code with. It's basic desires that any website should need at least sometime.
Based on what my desire is, what would be the best framework (if that's even the right term for this) to learn and use?
Would I be better off using Microsoft Visual Studio to code in as well using Microsoft specific frameworks like MVC, or would a open source provide better and more functionality?
I know many beginning web developers would benefit from this as well.
Thanks
|
|
|
|
|
|
There really is no answer. What might be easy to learn for one may not be for another. If you already have some experience in web development and you can do what you need to do in that language you already know, stick with that.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
It actually depends on the facts like, what you want to do and how long you have to deal with the projects. Every tool is build for a reason..
But nowadays the open source like wordpress, majento are more popular than the Frameworks as it is really easy to use, even if you don’t have programming knowledge you can easily create a website with the open source platform. And if you want to choose the framework to develop your site or application it's not a bad choice at all, but consider some key points like popularity of the framework, support, security, community size, etc..
And if you ask, which is the best framework to use, I will suggest you CakePHP & Laravel..
|
|
|
|
|
Hi all, I saw a code snippet that looked similar to JSON but it did not use curly braces. Instead it uses square brackets like the following
[
["Age", 25],["Age", 26]
]
I only had a glance at the code and not sure what it was. Is it C# or Javascript syntax? Thanks in advance for your reply.
|
|
|
|
|
Arrays in an Array in JavaScript:
var ages = [
["Age", 25],["Age", 26]
]
alert(ages[1]);
alert(ages[1][1]);
|
|
|
|
|
I'm looking for a poster (or website) that maps the technologies that can be used to create software. Something like this: http://www.microsoft.com/en-in/download/confirmation.aspx?id=39952[^]
The problem I'm having is every technology I study seems to lead to some other technology I need to study before I can solve my basic problem.
Currently, I'm wanting to create my own dash board for services running on my network. So I want to grab data like, had disk space, cpu and network bandwidth utilization metrics from Windows servers, and show those in a dash board. Yes, I could buy an off the shelf product, but what fun is there in that?
Point is, I need to "query a server" (WMI, Websockets, JSON, Webservices), I need to store data points in a database(SQL, mySQL, XML, JSON), then I want to show it dynamically in a page(MVC, JavaScript, node.js, angular.js) and on and on and on and on.
What I was hoping for was a place where someone has taken the 10,000' few and said: Hey if you're a .Net guy, use MS-MVC, and WMI and store it all in SQL Server and use EntityFrameWork to "CRUD".
But what you get is, buy my $35.00 book that will walk you through 6 way's we "used" to do stuff, then shows you how we "will do it soon" when the next great flavor of HTML9 comes out or CSS12 ect.
Any help?
|
|
|
|
|
How do I protect unauthorized calls through the API? I know I will have a login process, but do I login on each call to each method? Or do I pass some kind of token to each call?
If it's not broken, fix it until it is
|
|
|
|
|
You can pass the user credentials (login and password) in request header for the first time. Then, login for that client in the server. Then, other subsequent calls should not require authentication till session time-out (Or the way you implemented authentication/authorization).
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
may be you can use the ASP.NET session global variable. you can check it before you perform any following loading process.
|
|
|
|
|
One way to achieve this would be to have a cookie based authentication where when a user calls the login method a cookie is sent to the user and this cookie can be used to authenticate the user.
But the above mentioned approach is not recommended as the cookies don;t gel well with complete restful services. If we have a mix of website and rest api then it works well as we can ask the user to login from the web page and the api can simply check for authentication cookie.
So the recommended approach is to have a token based authentication. when a user logs in, generate a token for the user and send it back to the client. the client will then have to send this token back in the header with every request. following article shows how this can be done - http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api[^]
|
|
|
|
|